Class FramedSnappyCompressorOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.commons.compress.compressors.CompressorOutputStream<OutputStream>
org.apache.commons.compress.compressors.snappy.FramedSnappyCompressorOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
CompressorOutputStream for the framing Snappy format.
Based on the "spec" in the version "Last revised: 2013-10-25"
- Since:
- 1.14
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private final org.apache.commons.codec.digest.PureJavaCrc32Cprivate final ByteUtils.ByteConsumerprivate intprivate static final intprivate final byte[]private final ParametersFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new output stream that compresses snappy-framed-compressed data to the specified output stream.FramedSnappyCompressorOutputStream(OutputStream out, Parameters params) Constructs a new output stream that compresses snappy-framed-compressed data to the specified output stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidfinish()Compresses all remaining data and writes it to the stream, doesn't close the underlying stream.private void(package private) static longmask(long x) voidwrite(byte[] data, int off, int len) voidwrite(int b) private voidwriteCrc()private voidwriteLittleEndian(int numBytes, long num) Methods inherited from class org.apache.commons.compress.compressors.CompressorOutputStream
outMethods inherited from class java.io.FilterOutputStream
flush, write
-
Field Details
-
MAX_COMPRESSED_BUFFER_SIZE
private static final int MAX_COMPRESSED_BUFFER_SIZE- See Also:
-
params
-
checksum
private final org.apache.commons.codec.digest.PureJavaCrc32C checksum -
oneByte
private final byte[] oneByte -
buffer
private final byte[] buffer -
currentIndex
private int currentIndex -
consumer
-
-
Constructor Details
-
FramedSnappyCompressorOutputStream
Constructs a new output stream that compresses snappy-framed-compressed data to the specified output stream.- Parameters:
out- the OutputStream to which to write the compressed data- Throws:
IOException- if writing the signature fails
-
FramedSnappyCompressorOutputStream
Constructs a new output stream that compresses snappy-framed-compressed data to the specified output stream.- Parameters:
out- the OutputStream to which to write the compressed dataparams- parameters used to fine-tune compression, in particular to balance compression ratio vs compression speed.- Throws:
IOException- if writing the signature fails
-
-
Method Details
-
mask
static long mask(long x) -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-
finish
Compresses all remaining data and writes it to the stream, doesn't close the underlying stream.- Throws:
IOException- if an error occurs
-
flushBuffer
- Throws:
IOException
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
writeCrc
- Throws:
IOException
-
writeLittleEndian
- Throws:
IOException
-