@Test(expected = IllegalArgumentException.class) public void bufferLengthShouldNotExceedMaxArrayLength() throws IOException { BlockGetter tooBigGetter = new BlockGetter() { @Override public void get(long firstBlock, long numBlocks, OutputStream destination) { } @Override public int expectedBlockLength() { return Integer.MAX_VALUE - 7; } }; BlockConsumingInputStream.create(tooBigGetter, 2, 1); }
public static BlockConsumingInputStream create( BlockGetter blockGetter, long numBlocks, int blocksInMemory) throws IOException { ensureExpectedArraySizeDoesNotOverflow(blockGetter, blocksInMemory); return new BlockConsumingInputStream(blockGetter, numBlocks, blocksInMemory); }
BlockConsumingInputStream extends InputStream { public static BlockConsumingInputStream create( BlockGetter blockGetter, long numBlocks, int blocksInMemory) throws IOException { ensureExpectedArraySizeDoesNotOverflow(blockGetter, blocksInMemory); return new BlockConsumingInputStream(blockGetter, numBlocks, blocksInMemory); } }
BlockConsumingInputStream extends InputStream { public static BlockConsumingInputStream create( BlockGetter blockGetter, long numBlocks, int blocksInMemory) throws IOException { ensureExpectedArraySizeDoesNotOverflow(blockGetter, blocksInMemory); return new BlockConsumingInputStream(blockGetter, numBlocks, blocksInMemory); } private  BlockConsumingInputStream(BlockGetter blockGetter, long numBlocks, int blocksInMemory); }
BlockConsumingInputStream extends InputStream { public static BlockConsumingInputStream create( BlockGetter blockGetter, long numBlocks, int blocksInMemory) throws IOException { ensureExpectedArraySizeDoesNotOverflow(blockGetter, blocksInMemory); return new BlockConsumingInputStream(blockGetter, numBlocks, blocksInMemory); } 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 { public static BlockConsumingInputStream create( BlockGetter blockGetter, long numBlocks, int blocksInMemory) throws IOException { ensureExpectedArraySizeDoesNotOverflow(blockGetter, blocksInMemory); return new BlockConsumingInputStream(blockGetter, numBlocks, blocksInMemory); } 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);  }