public class SnzOutputStream extends OutputStream
This class implements a stream filter for writing compressed data in the SNZ file format.
The data format is compatible to the snzip tool, which is available as a patch to the official Snappy source code.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
| Constructor and Description |
|---|
SnzOutputStream(OutputStream out)
Creates a new compressing output stream with the default buffer size.
|
SnzOutputStream(OutputStream out,
int bufferSize)
Creates a new compressing output stream with the specified buffer size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Flushes the remaining data into a new compressed block, writes an end-of-stream
marker and closes the underlaying output stream.
|
int |
getCompressionEffort()
Returns the compression effort used by this stream.
|
void |
setCompressionEffort(int effort)
Sets the compression effort used by this stream from 1 (fastest, less
compression) to 100 (slowest, best compression).
|
void |
write(byte[] data)
Writes the content of
data to the compressed output stream. |
void |
write(byte[] data,
int offset,
int length)
Writes
length bytes of data to the compressed stream
from data, starting at index offset. |
void |
write(int data)
Writes the byte to the compressed output stream.
|
flushpublic static final int DEFAULT_BUFFER_SIZE
public SnzOutputStream(OutputStream out) throws IOException
out - target output streamIOExceptionpublic SnzOutputStream(OutputStream out, int bufferSize) throws IOException
out - target output streambufferSize - buffer size must be a power of 2 between 2**0 and 2**29IOExceptionpublic void write(int data)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] data)
throws IOException
data to the compressed output stream.write in class OutputStreamIOExceptionpublic void write(byte[] data,
int offset,
int length)
throws IOException
length bytes of data to the compressed stream
from data, starting at index offset.write in class OutputStreamIOExceptionpublic int getCompressionEffort()
public void setCompressionEffort(int effort)
effort - public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionCopyright © 2014 AVAST Software. All Rights Reserved.