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

        return getBufIfOpen()[pos++] & 0xff;
    }
@Test
    public void testEndOfFileForMethodRead() throws IOException {
        ByteBuffer inputBuf = ByteBuffer.allocate(2);
        int lengthGreaterThanInput = inputBuf.capacity() + 1;

        try (InputStream is = new ChunkedBytesStream(new ByteBufferInputStream(inputBuf), supplier, 10, false)) {
            int cnt = 0;
            while (cnt++ < lengthGreaterThanInput) {
                int res = is.read();
                if (cnt > inputBuf.capacity())
                    assertEquals(-1, res, "end of file for read should be -1");
            }
        }
    }