Class FramedSnappyCompressorOutputStream
java.lang.Object
java.io.OutputStream
org.apache.commons.compress.compressors.CompressorOutputStream
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 PureJavaCrc32C
private final ByteUtils.ByteConsumer
private int
private static final int
private final byte[]
private final OutputStream
private final Parameters
-
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 TypeMethodDescriptionvoid
close()
void
finish()
Compresses all remaining data and writes it to the stream, doesn't close the underlying stream.private void
(package private) static long
mask
(long x) void
write
(byte[] data, int off, int len) void
write
(int b) private void
writeCrc()
private void
writeLittleEndian
(int numBytes, long num) Methods inherited from class java.io.OutputStream
flush, write
-
Field Details
-
MAX_COMPRESSED_BUFFER_SIZE
private static final int MAX_COMPRESSED_BUFFER_SIZE- See Also:
-
out
-
params
-
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
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- 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
-
writeLittleEndian
- Throws:
IOException
-
writeCrc
- Throws:
IOException
-
mask
static long mask(long x)
-