@@ -37,6 +37,7 @@ public interface ReadChannel extends ReadableByteChannel, Closeable, Restorable<
37
37
@ Override
38
38
void close ();
39
39
40
+ /** Set the offset to read from. */
40
41
void seek (long position ) throws IOException ;
41
42
42
43
/**
@@ -62,6 +63,23 @@ public interface ReadChannel extends ReadableByteChannel, Closeable, Restorable<
62
63
* <p>If used in conjunction with {@link #seek(long)} the total number of returned bytes from this
63
64
* channel will be reduced by the number of bytes specified to seek.
64
65
*
66
+ * <p>The value provided as {@code limit} will define a <a target="_blank" rel="noopener
67
+ * noreferrer"
68
+ * href="https://en.wikipedia.org/wiki/Interval_(mathematics)#Classification_of_intervals">left-closed,
69
+ * right-open</a> interval along with either {@code 0} or any value provided to {@link
70
+ * #seek(long)}, i.e. {@code [}{@link #seek(long)}{@code , }{@link #limit(long)}{@code )}.
71
+ *
72
+ * <h3>An example to help illustrate the relationship</h3>
73
+ *
74
+ * Imagine some data {@code [A, B, C, D, E, F, G, H, I, J]}, 10 bytes total.
75
+ *
76
+ * <ol>
77
+ * <li>{@code limit(5)} would produce {@code [A, B, C, D, E]}
78
+ * <li>{@code seek(8)} would produce {@code [I, J]}
79
+ * <li>{@code seek(2)} {@code limit(5)} would produce {@code [C, D, E]}
80
+ * <li>{@code seek(3)} {@code limit(3)} would produce {@code []}
81
+ * </ol>
82
+ *
65
83
* <p><i>NOTE:</i>Implementers are not required to return a new instance from this method, however
66
84
* they are allowed to. Users of this method should always use the instance returned from this
67
85
* method.
0 commit comments