public final class SnappyFramedOutputStream extends OutputStream implements WritableByteChannel
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BLOCK_SIZE
The default block size to use.
|
static double |
DEFAULT_MIN_COMPRESSION_RATIO
The default min compression ratio to use.
|
static int |
MAX_BLOCK_SIZE
The x-snappy-framed specification allows for a chunk size up to
16,777,211 bytes in length.
|
| Constructor and Description |
|---|
SnappyFramedOutputStream(OutputStream out)
Creates a new
SnappyFramedOutputStream using the DEFAULT_BLOCK_SIZE
and DEFAULT_MIN_COMPRESSION_RATIO. |
SnappyFramedOutputStream(OutputStream out,
int blockSize,
double minCompressionRatio)
Creates a new
SnappyFramedOutputStream instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
boolean |
isOpen() |
void |
write(byte[] input,
int offset,
int length) |
int |
write(ByteBuffer src) |
void |
write(int b) |
writepublic 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.
public static final int DEFAULT_BLOCK_SIZE
public static final double DEFAULT_MIN_COMPRESSION_RATIO
public SnappyFramedOutputStream(OutputStream out) throws IOException
SnappyFramedOutputStream using the DEFAULT_BLOCK_SIZE
and DEFAULT_MIN_COMPRESSION_RATIO.out - The underlying OutputStream to write to. Must not be
null.IOExceptionpublic SnappyFramedOutputStream(OutputStream out, int blockSize, double minCompressionRatio) throws IOException
SnappyFramedOutputStream instance.out - The underlying OutputStream to write to. Must not be
null.blockSize - The block size (of raw data) to compress before writing frames
to out. Must be in (0, 65536].minCompressionRatio - Defines the minimum compression ratio (
compressedLength / rawLength) that must be achieved to
write the compressed data. This must be in (0, 1.0].IOExceptionpublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] input,
int offset,
int length)
throws IOException
write in class OutputStreamIOExceptionpublic int write(ByteBuffer src) throws IOException
write in interface WritableByteChannelIOExceptionpublic final void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic final void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in class OutputStreamIOExceptionCopyright © 2011-2013 xerial.org. All Rights Reserved.