Package io.airlift.compress.snappy
Class SnappyFramedOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- io.airlift.compress.snappy.SnappyFramedOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public final class SnappyFramedOutputStream extends OutputStream
Implements the x-snappy-framed as anOutputStream.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_BLOCK_SIZEstatic doubleDEFAULT_MIN_COMPRESSION_RATIOstatic intMAX_BLOCK_SIZEWe place an additional restriction that the uncompressed data in a chunk must be no longer than 65536 bytes.
-
Constructor Summary
Constructors Constructor Description SnappyFramedOutputStream(OutputStream out)Creates a Snappy output stream to write data to the specified underlying output stream.SnappyFramedOutputStream(OutputStream out, boolean writeChecksums, int blockSize, double minCompressionRatio)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()static SnappyFramedOutputStreamnewChecksumFreeBenchmarkOutputStream(OutputStream out)Creates 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 Detail
-
MAX_BLOCK_SIZE
public static final int MAX_BLOCK_SIZE
We 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:
- Constant Field Values
-
DEFAULT_BLOCK_SIZE
public static final int DEFAULT_BLOCK_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MIN_COMPRESSION_RATIO
public static final double DEFAULT_MIN_COMPRESSION_RATIO
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SnappyFramedOutputStream
public SnappyFramedOutputStream(OutputStream out) throws IOException
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 Detail
-
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
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] input, int offset, int length) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
-