@Override
    public int read() throws IOException {
        if (pos >= count) {
            fill();
            if (pos >= count)
                return -1;
        }

        return getBufIfOpen()[pos++] & 0xff;
    }
@Test
    public void testEofErrorForMethodReadFully() throws IOException {
        ByteBuffer input = ByteBuffer.allocate(8);
        int lengthGreaterThanInput = input.capacity() + 1;
        byte[] got = new byte[lengthGreaterThanInput];
        try (InputStream is = new ChunkedBytesStream(new ByteBufferInputStream(input), supplier, 10, false)) {
            assertEquals(8, is.read(got, 0, got.length), "Should return 8 signifying end of input");
        }
    }