Package io.airlift.compress.snappy
Class SnappyFramedOutputStream
java.lang.Object
java.io.OutputStream
io.airlift.compress.snappy.SnappyFramedOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Implements the x-snappy-framed as an
OutputStream.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final doublestatic final intWe place an additional restriction that the uncompressed data in a chunk must be no longer than 65536 bytes. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a Snappy output stream to write data to the specified underlying output stream.SnappyFramedOutputStream(OutputStream out, boolean writeChecksums, int blockSize, double minCompressionRatio) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()static SnappyFramedOutputStreamCreates a Snappy output stream with block checksums disabled.voidwrite(byte[] input, int offset, int length) voidwrite(int b) Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Field Details
-
MAX_BLOCK_SIZE
public static final int MAX_BLOCK_SIZEWe place an additional restriction that the uncompressed data in a chunk must be no longer than 65536 bytes. This allows consumers to easily use small fixed-size buffers.- See Also:
-
DEFAULT_BLOCK_SIZE
public static final int DEFAULT_BLOCK_SIZE- See Also:
-
DEFAULT_MIN_COMPRESSION_RATIO
public static final double DEFAULT_MIN_COMPRESSION_RATIO- See Also:
-
-
Constructor Details
-
SnappyFramedOutputStream
Creates a Snappy output stream to write data to the specified underlying output stream.- Parameters:
out- the underlying output stream- Throws:
IOException
-
SnappyFramedOutputStream
public SnappyFramedOutputStream(OutputStream out, boolean writeChecksums, int blockSize, double minCompressionRatio) throws IOException - Throws:
IOException
-
-
Method Details
-
newChecksumFreeBenchmarkOutputStream
public static SnappyFramedOutputStream newChecksumFreeBenchmarkOutputStream(OutputStream out) throws IOException Creates a Snappy output stream with block checksums disabled. This is only useful for apples-to-apples benchmarks with other compressors that do not perform block checksums.- Parameters:
out- the underlying output stream- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-