@Signature public void __construct(Environment env, InputStream inputStream, boolean framed) throws IOException { this.inputStream = framed ? new FramedLZ4CompressorInputStream(inputStream) : new BlockLZ4CompressorInputStream(inputStream); } }
private void nextBlock() throws IOException { maybeFinishCurrentBlock(); long len = ByteUtils.fromLittleEndian(supplier, 4); boolean uncompressed = (len & UNCOMPRESSED_FLAG_MASK) != 0; int realLen = (int) (len & (~UNCOMPRESSED_FLAG_MASK)); if (realLen == 0) { verifyContentChecksum(); if (!decompressConcatenated) { endReached = true; } else { init(false); } return; } InputStream capped = new BoundedInputStream(in, realLen); if (expectBlockChecksum) { capped = new ChecksumCalculatingInputStream(blockHash, capped); } if (uncompressed) { inUncompressed = true; currentBlock = capped; } else { inUncompressed = false; BlockLZ4CompressorInputStream s = new BlockLZ4CompressorInputStream(capped); if (expectBlockDependency) { s.prefill(blockDependencyBuffer); } currentBlock = s; } }
/** * @param stream the stream to read from, should be buffered */ @Override public CompressorInputStream getCompressorStream(InputStream stream) throws IOException { return framed ? new FramedLZ4CompressorInputStream(stream) : (CompressorInputStream) new BlockLZ4CompressorInputStream(stream); }
/** * @param stream the stream to read from, should be buffered * @param decompressConcatenated * if true, decompress until the end of the * input; if false, stop after the first * stream */ @Override public CompressorInputStream getCompressorStream(InputStream stream, boolean decompressConcatenated) throws IOException { if (!framed && decompressConcatenated) { throw new UnsupportedOperationException("only the frame format supports" + " concatenated streams"); } return framed ? new FramedLZ4CompressorInputStream(stream, decompressConcatenated) : (CompressorInputStream) new BlockLZ4CompressorInputStream(stream); }
private void nextBlock() throws IOException { maybeFinishCurrentBlock(); long len = ByteUtils.fromLittleEndian(supplier, 4); boolean uncompressed = (len & UNCOMPRESSED_FLAG_MASK) != 0; int realLen = (int) (len & (~UNCOMPRESSED_FLAG_MASK)); if (realLen == 0) { verifyContentChecksum(); if (!decompressConcatenated) { endReached = true; } else { init(false); } return; } InputStream capped = new BoundedInputStream(in, realLen); if (expectBlockChecksum) { capped = new ChecksumCalculatingInputStream(blockHash, capped); } if (uncompressed) { inUncompressed = true; currentBlock = capped; } else { inUncompressed = false; BlockLZ4CompressorInputStream s = new BlockLZ4CompressorInputStream(capped); if (expectBlockDependency) { s.prefill(blockDependencyBuffer); } currentBlock = s; } }