Package net.jpountz.lz4
Class LZ4FrameOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
net.jpountz.lz4.LZ4FrameOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
Implementation of the v1.5.1 LZ4 Frame format. This class is NOT thread safe.
Not Supported:
- Dependent blocks
- Legacy streams
- Multiple frames (one LZ4FrameOutputStream is one frame)
Originally based on kafka's KafkaLZ4BlockOutputStream.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static enum
static class
-
Field Summary
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newOutputStream
that will compress data using the LZ4 algorithm with 4-MB blocks.LZ4FrameOutputStream
(OutputStream out, LZ4FrameOutputStream.BLOCKSIZE blockSize) Creates a newOutputStream
that will compress data using the LZ4 algorithm.LZ4FrameOutputStream
(OutputStream out, LZ4FrameOutputStream.BLOCKSIZE blockSize, long knownSize, LZ4Compressor compressor, XXHash32 checksum, LZ4FrameOutputStream.FLG.Bits... bits) Creates a newOutputStream
that will compress data using the specified instances ofLZ4Compressor
andXXHash32
.LZ4FrameOutputStream
(OutputStream out, LZ4FrameOutputStream.BLOCKSIZE blockSize, long knownSize, LZ4FrameOutputStream.FLG.Bits... bits) Creates a newOutputStream
that will compress data using using fastest instances ofLZ4Compressor
andXXHash32
.LZ4FrameOutputStream
(OutputStream out, LZ4FrameOutputStream.BLOCKSIZE blockSize, LZ4FrameOutputStream.FLG.Bits... bits) Creates a newOutputStream
that will compress data of unknown size using the LZ4 algorithm. -
Method Summary
Methods inherited from class java.io.FilterOutputStream
write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
LZ4FrameOutputStream
public LZ4FrameOutputStream(OutputStream out, LZ4FrameOutputStream.BLOCKSIZE blockSize, LZ4FrameOutputStream.FLG.Bits... bits) throws IOException Creates a newOutputStream
that will compress data of unknown size using the LZ4 algorithm.- Parameters:
out
- the output stream to compressblockSize
- the BLOCKSIZE to usebits
- a set of features to use- Throws:
IOException
- if an I/O error occurs- See Also:
-
LZ4FrameOutputStream
public LZ4FrameOutputStream(OutputStream out, LZ4FrameOutputStream.BLOCKSIZE blockSize, long knownSize, LZ4FrameOutputStream.FLG.Bits... bits) throws IOException Creates a newOutputStream
that will compress data using using fastest instances ofLZ4Compressor
andXXHash32
.- Parameters:
out
- the output stream to compressblockSize
- the BLOCKSIZE to useknownSize
- the size of the uncompressed data. A value less than zero means unknown.bits
- a set of features to use- Throws:
IOException
- if an I/O error occurs
-
LZ4FrameOutputStream
public LZ4FrameOutputStream(OutputStream out, LZ4FrameOutputStream.BLOCKSIZE blockSize, long knownSize, LZ4Compressor compressor, XXHash32 checksum, LZ4FrameOutputStream.FLG.Bits... bits) throws IOException Creates a newOutputStream
that will compress data using the specified instances ofLZ4Compressor
andXXHash32
.- Parameters:
out
- the output stream to compressblockSize
- the BLOCKSIZE to useknownSize
- the size of the uncompressed data. A value less than zero means unknown.compressor
- theLZ4Compressor
instance to use to compress datachecksum
- theXXHash32
instance to use to check data for integritybits
- a set of features to use- Throws:
IOException
- if an I/O error occurs
-
LZ4FrameOutputStream
public LZ4FrameOutputStream(OutputStream out, LZ4FrameOutputStream.BLOCKSIZE blockSize) throws IOException Creates a newOutputStream
that will compress data using the LZ4 algorithm. The block independence flag is set, and none of the other flags are set.- Parameters:
out
- The stream to compressblockSize
- the BLOCKSIZE to use- Throws:
IOException
- if an I/O error occurs- See Also:
-
LZ4FrameOutputStream
Creates a newOutputStream
that will compress data using the LZ4 algorithm with 4-MB blocks.- Parameters:
out
- the output stream to compress- Throws:
IOException
- if an I/O error occurs- See Also:
-
-
Method Details
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classFilterOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-