public class SnappyCompressor extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_EFFORT
Default effort used for compression
|
| Modifier and Type | Method and Description |
|---|---|
static Buffer |
compress(Buffer in)
Equivalent to
compress(in.getData(), 0, in.getLength(), null). |
static Buffer |
compress(Buffer in,
Buffer out)
Equivalent to
compress(in.getData(), 0, in.getLength(), out). |
static Buffer |
compress(byte[] in)
Equivalent to
compress(in, 0, in.length, null). |
static Buffer |
compress(byte[] in,
Buffer out)
Equivalent to
compress(in, 0, in.length, out). |
static Buffer |
compress(byte[] in,
int offset,
int length)
Equivalent to
compress(in, offset, length, null). |
static Buffer |
compress(byte[] in,
int offset,
int length,
Buffer out)
Equivalent to
compress(in.getData(), 0, in.getLength(), out, DEFAULT_EFFORT). |
static Buffer |
compress(byte[] in,
int offset,
int length,
Buffer out,
int effort)
Compress the data contained in
in from offset
and length bytes. |
public static final int DEFAULT_EFFORT
public static Buffer compress(byte[] in)
compress(in, 0, in.length, null).in - data to be compressedpublic static Buffer compress(byte[] in, Buffer out)
compress(in, 0, in.length, out).in - data to be compressedout - Buffer for compressed data blockoutpublic static Buffer compress(byte[] in, int offset, int length)
compress(in, offset, length, null).in - data to be compressedoffset - offset in in, on which encoding is startedlength - number of bytes read from the input blockpublic static Buffer compress(Buffer in)
compress(in.getData(), 0, in.getLength(), null).in - data to be compressedpublic static Buffer compress(Buffer in, Buffer out)
compress(in.getData(), 0, in.getLength(), out).in - data to be compressedout - buffer for decompressed data blockoutpublic static Buffer compress(byte[] in, int offset, int length, Buffer out)
compress(in.getData(), 0, in.getLength(), out, DEFAULT_EFFORT).in - input dataoffset - offset into input datalength - length of input dataout - output buffer or null (new buffer will be allocated)outpublic static Buffer compress(byte[] in, int offset, int length, Buffer out, int effort)
Compress the data contained in in from offset
and length bytes. If an output buffer is provided, the buffer
is reused for the compressed data. If the buffer is too small, its capacity
is expanded to fit the result. If a null argument is passed,
a new buffer is allocated.
The compression effort can be set from 1 (fastest, less compression) to 100 (slowest, highest compression).
in - input dataoffset - offset into input datalength - length of input dataout - output buffer or null (new buffer will be allocated)effort - compression effortCopyright © 2014 AVAST Software. All Rights Reserved.