- public boolean next() {
- if (!hasMoreData() && step != null) {
- len = step.getResumeLen();
- pos += step.getSkip();
- eof = false;
- step = null;
-
- checkNexts(false);
-
- return true;
- }
-
- return false;
+ /**
+ * Create a new {@link NextableInputStream} that wraps the given bytes array
+ * as a data source.
+ *
+ * @param in
+ * the array to wrap, cannot be NULL
+ * @param step
+ * how to separate it into sub-streams (can be NULL, but in that
+ * case it will behave as a normal {@link InputStream})
+ * @param offset
+ * the offset to start the reading at
+ * @param length
+ * the number of bytes to take into account in the array,
+ * starting from the offset
+ *
+ * @throws NullPointerException
+ * if the array is NULL
+ * @throws IndexOutOfBoundsException
+ * if the offset and length do not correspond to the given array
+ */
+ public NextableInputStream(byte[] in, NextableInputStreamStep step,
+ int offset, int length) {
+ super(in, offset, length);
+ this.step = step;
+ checkBuffer(true);