public interface Compression
init(int, int)
method.
One Compression object will be used either for compression
or decompression, not both.Modifier and Type | Field and Description |
---|---|
static int |
DEFLATER
Constant for deflating (compressing) mode.
|
static int |
INFLATER
Constant for inflating (decompressing) mode.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
compress(byte[] buf,
int start,
int[] len)
Compresses a chunk of data.
|
void |
init(int type,
int level)
Initializes the compression engine.
|
byte[] |
uncompress(byte[] buf,
int start,
int[] len)
Uncompresses a chunk of data.
|
static final int INFLATER
static final int DEFLATER
void init(int type, int level)
type
- one of INFLATER
or DEFLATER
.
In the first case the library later will only call uncompress(byte[], int, int[])
,
in the second case only compress(byte[], int, int[])
.level
- the compression level. This is only relevant for the
DEFLATER
mode.byte[] compress(byte[] buf, int start, int[] len)
buf
- the buffer containing the uncompressed data.start
- the position in the buffer where the uncompressed
data starts. At the same position we will put the compressed
data.len
- an array, containing in len[0]
the length of the
uncompressed chunk. After returning, this will contain the length
of the compressed version of this chunk.buf
(if there was enough space), or a new array.byte[] uncompress(byte[] buf, int start, int[] len)
buf
- the buffer containing the compressed data. We will put
the uncompressed data in the same buffer, if there is enough
space. Otherwise, there will be a new buffer created.start
- the position in buf
where the chunk of
compressed data starts.len
- an array, containing in len[0]
the length of the
compressed chunk. After returning, it will contain the
length of the uncompressed version of this chunk.buf
(if there was enough space for the
uncompressed data) or a new buffer containing all the data
from buf
before start
and then the result of
uncompressing the compressed chunk.This is an inofficial Javadoc created by PaĆlo Ebermann. Have a look at the official homepage.