@@ -37,6 +37,7 @@ public interface ReadChannel extends ReadableByteChannel, Closeable, Restorable<
3737 @ Override
3838 void close ();
3939
40+ /** Set the offset to read from. */
4041 void seek (long position ) throws IOException ;
4142
4243 /**
@@ -62,6 +63,23 @@ public interface ReadChannel extends ReadableByteChannel, Closeable, Restorable<
6263 * <p>If used in conjunction with {@link #seek(long)} the total number of returned bytes from this
6364 * channel will be reduced by the number of bytes specified to seek.
6465 *
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+ *
6583 * <p><i>NOTE:</i>Implementers are not required to return a new instance from this method, however
6684 * they are allowed to. Users of this method should always use the instance returned from this
6785 * method.
0 commit comments