@Test public void canReadSingleByte() throws IOException { int byteAsInt = dataStream.read(); byte[] readByte = { (byte) byteAsInt }; assertEquals("d", new String(readByte, StandardCharsets.UTF_8)); }
@Override public int read() throws IOException { if (positionInBuffer < buffer.length) { return buffer[positionInBuffer++] & 0xff; } if (nextBlockToRead < numBlocks) { boolean reloaded = refillBuffer(); if (!reloaded) { return -1; } return buffer[positionInBuffer++] & 0xff; } return -1; }
BlockConsumingInputStream extends InputStream { @Override public int read() throws IOException { if (positionInBuffer < buffer.length) { return buffer[positionInBuffer++] & 0xff; } if (nextBlockToRead < numBlocks) { boolean reloaded = refillBuffer(); if (!reloaded) { return -1; } return buffer[positionInBuffer++] & 0xff; } return -1; } }
BlockConsumingInputStream extends InputStream { @Override public int read() throws IOException { if (positionInBuffer < buffer.length) { return buffer[positionInBuffer++] & 0xff; } if (nextBlockToRead < numBlocks) { boolean reloaded = refillBuffer(); if (!reloaded) { return -1; } return buffer[positionInBuffer++] & 0xff; } return -1; } private  BlockConsumingInputStream(BlockGetter blockGetter, long numBlocks, int blocksInMemory); }
BlockConsumingInputStream extends InputStream { @Override public int read() throws IOException { if (positionInBuffer < buffer.length) { return buffer[positionInBuffer++] & 0xff; } if (nextBlockToRead < numBlocks) { boolean reloaded = refillBuffer(); if (!reloaded) { return -1; } return buffer[positionInBuffer++] & 0xff; } return -1; } private  BlockConsumingInputStream(BlockGetter blockGetter, long numBlocks, int blocksInMemory); static BlockConsumingInputStream create(
            BlockGetter blockGetter,
            long numBlocks,
            int blocksInMemory); @Override int read(); @Override int read(byte[] bytes, int off, int len); }
BlockConsumingInputStream extends InputStream { @Override public int read() throws IOException { if (positionInBuffer < buffer.length) { return buffer[positionInBuffer++] & 0xff; } if (nextBlockToRead < numBlocks) { boolean reloaded = refillBuffer(); if (!reloaded) { return -1; } return buffer[positionInBuffer++] & 0xff; } return -1; } private  BlockConsumingInputStream(BlockGetter blockGetter, long numBlocks, int blocksInMemory); static BlockConsumingInputStream create(
            BlockGetter blockGetter,
            long numBlocks,
            int blocksInMemory); @Override int read(); @Override int read(byte[] bytes, int off, int len);  }