|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object joeq.ClassLib.Common.java.util.zip.Deflater
public class Deflater
Deflater
Field Summary | |
---|---|
static int |
BEST_COMPRESSION
The best and slowest compression level. |
static int |
BEST_SPEED
The worst but fastest compression level. |
static int |
DEFAULT_COMPRESSION
The default compression level. |
static int |
DEFAULT_STRATEGY
The default strategy. |
static int |
DEFLATED
The compression method. |
static int |
FILTERED
This strategy will only allow longer string repetitions. |
static int |
HUFFMAN_ONLY
This strategy will not look for string repetitions at all. |
static int |
NO_COMPRESSION
This level won't compress at all but output uncompressed blocks. |
Constructor Summary | |
---|---|
Deflater()
Creates a new deflater with default compression level. |
|
Deflater(int lvl)
Creates a new deflater with given compression level. |
|
Deflater(int lvl,
boolean nowrap)
Creates a new deflater with given compression level. |
Method Summary | |
---|---|
int |
deflate(byte[] output)
Deflates the current input block to the given array. |
int |
deflate(byte[] output,
int offset,
int length)
Deflates the current input block to the given array. |
void |
end()
Deprecated. Just clear all references to deflater instead. |
protected void |
finalize()
Finalizes this object. |
void |
finish()
Finishes the deflater with the current input block. |
boolean |
finished()
Returns true iff the stream was finished and no more output bytes are available. |
int |
getAdler()
Gets the current adler checksum of the data that was processed so far. |
int |
getTotalIn()
Gets the number of input bytes processed so far. |
int |
getTotalOut()
Gets the number of output bytes so far. |
boolean |
needsInput()
Returns true, if the input buffer is empty. |
void |
reset()
Resets the deflater. |
void |
setDictionary(byte[] dict)
Sets the dictionary which should be used in the deflate process. |
void |
setDictionary(byte[] dict,
int offset,
int length)
Sets the dictionary which should be used in the deflate process. |
void |
setInput(byte[] input)
Sets the data which should be compressed next. |
void |
setInput(byte[] input,
int off,
int len)
Sets the data which should be compressed next. |
void |
setLevel(int lvl)
Sets the compression level. |
void |
setStrategy(int stgy)
Sets the compression strategy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BEST_COMPRESSION
public static final int BEST_SPEED
public static final int DEFAULT_COMPRESSION
public static final int NO_COMPRESSION
public static final int DEFAULT_STRATEGY
public static final int FILTERED
public static final int HUFFMAN_ONLY
public static final int DEFLATED
Constructor Detail |
---|
public Deflater()
public Deflater(int lvl)
lvl
- the compression level, a value between NO_COMPRESSION
and BEST_COMPRESSION, or DEFAULT_COMPRESSION.
IllegalArgumentException
- if lvl is out of range.public Deflater(int lvl, boolean nowrap)
lvl
- the compression level, a value between NO_COMPRESSION
and BEST_COMPRESSION.nowrap
- true, iff we should suppress the deflate header at the
beginning and the adler checksum at the end of the output. This is
useful for the GZIP format.
IllegalArgumentException
- if lvl is out of range.Method Detail |
---|
public void reset()
public void end()
public int getAdler()
public int getTotalIn()
public int getTotalOut()
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public void finish()
public boolean finished()
public boolean needsInput()
public void setInput(byte[] input)
setInput(input, 0, input.length)
.
input
- the buffer containing the input data.
IllegalStateException
- if the buffer was finished() or ended().public void setInput(byte[] input, int off, int len)
input
- the buffer containing the input data.off
- the start of the data.len
- the length of the data.
IllegalStateException
- if the buffer was finished() or ended()
or if previous input is still pending.public void setLevel(int lvl)
lvl
- the new compression level.public void setStrategy(int stgy)
stgy
- the new compression strategy.public int deflate(byte[] output)
output
- the buffer where to write the compressed data.public int deflate(byte[] output, int offset, int length)
output
- the buffer where to write the compressed data.offset
- the offset into the output array.length
- the maximum number of bytes that may be written.
IllegalStateException
- if end() was called.
IndexOutOfBoundsException
- if offset and/or length
don't match the array length.public void setDictionary(byte[] dict)
setDictionary(dict, 0,
dict.length)
.
dict
- the dictionary.
IllegalStateException
- if setInput () or deflate ()
were already called or another dictionary was already set.public void setDictionary(byte[] dict, int offset, int length)
dict
- the dictionary.offset
- an offset into the dictionary.length
- the length of the dictionary.
IllegalStateException
- if setInput () or deflate () were
already called or another dictionary was already set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |