Package net.jpountz.lz4
Class LZ4BlockInputStream.Builder
java.lang.Object
net.jpountz.lz4.LZ4BlockInputStream.Builder
- Enclosing class:
LZ4BlockInputStream
Builder for
LZ4BlockInputStream-
Method Summary
Modifier and TypeMethodDescriptionbuild(InputStream in) Creates a new LZ4 input stream to read from the specified InputStream with specified parameterswithAcceptOversizedBlocks(boolean acceptOversizedBlocks) Registers whether the builder should accept oversized blocks whose compressed length is greater than or equal to the original length.withChecksum(Checksum checksum) RegistersChecksumto be used by the builderwithDecompressor(LZ4FastDecompressor fastDecompressor) RegistersLZ4FastDecompressorto be used by the builder as a decompressor.withDecompressor(LZ4SafeDecompressor safeDecompressor) RegistersLZ4SafeDecompressorto be used by the builder as a decompressor.withStopOnEmptyBlock(boolean stopOnEmptyBlock) Registers value of stopOnEmptyBlock to be used by the builder
-
Method Details
-
withStopOnEmptyBlock
Registers value of stopOnEmptyBlock to be used by the builder- Parameters:
stopOnEmptyBlock- whether read is stopped on an empty block- Returns:
- current builder instance
-
withAcceptOversizedBlocks
Registers whether the builder should accept oversized blocks whose compressed length is greater than or equal to the original length.Only enable this for trusted inputs. Accepting such blocks may permit large attacker-controlled allocations.
- Parameters:
acceptOversizedBlocks- whether oversized blocks should be accepted- Returns:
- current builder instance
- Since:
- 1.11.2
-
withDecompressor
RegistersLZ4FastDecompressorto be used by the builder as a decompressor. Overrides one set bywithDecompressor(LZ4SafeDecompressor)- Parameters:
fastDecompressor- theLZ4FastDecompressorinstance to use- Returns:
- current builder instance
-
withDecompressor
RegistersLZ4SafeDecompressorto be used by the builder as a decompressor. Overrides one set bywithDecompressor(LZ4FastDecompressor)- Parameters:
safeDecompressor- theLZ4SafeDecompressorinstance to use.- Returns:
- current builder instance
-
withChecksum
RegistersChecksumto be used by the builderNote: Since checksum objects are stateful, if you set one explicitly here, the builder can only be used once.
- Parameters:
checksum- theChecksuminstance to use, must be equivalent to the instance which has been used to write the stream- Returns:
- current builder instance
-
build
Creates a new LZ4 input stream to read from the specified InputStream with specified parameters- Parameters:
in- theInputStreamto poll- Returns:
- new instance of
LZ4BlockInputStreamusing parameters set in the builder and provided InputStream - See Also:
-