@@ -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 /**
@@ -55,12 +56,27 @@ public interface ReadChannel extends ReadableByteChannel, Closeable, Restorable<
5556 RestorableState <ReadChannel > capture ();
5657
5758 /**
58- * Limit the maximum number of bytes to be read from the objects content, counting from the
59- * beginning of the object, which will be available to read from this channel. If the limit is
59+ * Limit the maximum number of bytes available to be read from this channel. If the limit is
6060 * larger than the actual size of the content this will have no material impact.
6161 *
62- * <p>If used in conjunction with {@link #seek(long)} the total number of returned bytes from this
63- * channel will be reduced by the number of bytes specified to seek.
62+ * <p>The value provided as {@code limit} will define a <a target="_blank" rel="noopener
63+ * noreferrer"
64+ * href="https://en.wikipedia.org/wiki/Interval_(mathematics)#Classification_of_intervals">left-open,
65+ * right-closed</a> interval along with either {@code 0} or any value provided to {@link
66+ * #seek(long)}, i.e. {@code [}{@link #seek(long)}{@code , }{@link #limit(long)}{@code )}.
67+ *
68+ * <p>Whereas {@link #seek(long)} sets an offset, this method sets a quantity.
69+ *
70+ * <h3>An example to help illustrate the relationship</h3>
71+ *
72+ * Imagine some data {@code [A, B, C, D, E, F, G, H, I, J]}, 10 bytes total.
73+ *
74+ * <ol>
75+ * <li>{@code limit(5)} would produce {@code [A, B, C, D, E]}
76+ * <li>{@code seek(8)} would produce {@code [I, J]}
77+ * <li>{@code seek(2)} {@code limit(5)} would produce {@code [C, D, E]}
78+ * <li>{@code seek(3)} {@code limit(3)} would produce {@code []}
79+ * </ol>
6480 *
6581 * <p><i>NOTE:</i>Implementers are not required to return a new instance from this method, however
6682 * they are allowed to. Users of this method should always use the instance returned from this
0 commit comments