int read() {
        if (!hasNext()) {
            throw new IllegalStateException("This stream hasn't any other value, all values were already read.");
        }
        final int value = this.interval[nextPos];
        this.nextPos++;
        return value;
    }
Returns the value from current field (as {@code InputStream.read()} would do) and set the position of the pointer to the next field to read.

@return the value from current field (as {@code InputStream.read()} would do).
@throws IllegalStateException if the stream hasn't any other value.
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java