public int nextBit() throws ImagingException {
        if (cnt == 0) {
            b = read();
            if (b < 0) {
                throw new ImagingException("Premature End of File");
            }
            cnt = 8;
            if (b == 0xff) {
                final int b2 = read();
                if (b2 < 0) {
                    throw new ImagingException("Premature End of File");
                }
                if (b2 != 0) {
                    if (b2 == (0xff & JpegConstants.DNL_MARKER)) {
                        throw new ImagingException("DNL not yet supported");
                    }
                    throw new ImagingException("Invalid marker found " + "in entropy data: 0xFF " + Integer.toHexString(b2));
                }
            }
        }
        final int bit = b >> 7 & 0x1;
        cnt--;
        b <<= 1;
        return bit;
    }
Returns {@code true} as long there are unread fields available, else {@code false}

@return {@code true} as long there are unread fields available, else {@code false}
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java