@Test(expected = IllegalArgumentException.class) public void bufferLengthCanNotQuiteReachIntMaxValue() throws IOException { BlockGetter reallyBigGetter = new BlockGetter() { @Override public void get(long firstBlock, long numBlocks, OutputStream destination) { } @Override public int expectedBlockLength() { return (Integer.MAX_VALUE - 1) / 8; } }; int blocksInMemory = 8; assertTrue("Test assumption violated: expectedBlockLength() * blocksInMemory > MAX_IN_MEMORY_THRESHOLD.", (long) reallyBigGetter.expectedBlockLength() * (long) blocksInMemory > StreamStoreDefinition.MAX_IN_MEMORY_THRESHOLD); BlockConsumingInputStream.create(reallyBigGetter, 9, blocksInMemory); }
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);  }