|
|||||||||
Home >> All >> ClassLib >> Common >> java >> util >> [ zip overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
ClassLib.Common.java.util.zip
Class Deflater

java.lang.ObjectClassLib.Common.java.util.zip.Deflater
- public class Deflater
- extends java.lang.Object
Deflater
- Version:
- $Id: Deflater.java,v 1.5 2003/05/12 10:04:53 joewhaley Exp $
Field Summary | |
static int |
BEST_COMPRESSION
The best and slowest compression level. |
static int |
BEST_SPEED
The worst but fastest compression level. |
private static int |
BUSY_STATE
|
private static int |
CLOSED_STATE
|
static int |
DEFAULT_COMPRESSION
The default compression level. |
static int |
DEFAULT_STRATEGY
The default strategy. |
static int |
DEFLATED
The compression method. |
private DeflaterEngine |
engine
The deflater engine. |
static int |
FILTERED
This strategy will only allow longer string repetitions. |
private static int |
FINISHED_STATE
|
private static int |
FINISHING_STATE
|
private static int |
FLUSHING_STATE
|
static int |
HUFFMAN_ONLY
This strategy will not look for string repetitions at all. |
private static int |
INIT_FINISHING_STATE
|
private static int |
INIT_STATE
|
private static int |
IS_FINISHING
|
private static int |
IS_FLUSHING
|
private static int |
IS_SETDICT
|
private int |
level
Compression level. |
static int |
NO_COMPRESSION
This level won't compress at all but output uncompressed blocks. |
private boolean |
noHeader
should we include a header. |
private DeflaterPending |
pending
The pending output. |
private static int |
SETDICT_FINISHING_STATE
|
private static int |
SETDICT_STATE
|
private int |
state
The current state. |
private int |
strategy
Compression strategy. |
private int |
totalOut
The total bytes of output written. |
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. |
(package private) void |
flush()
Flushes the current input block. |
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. |
private static void |
initIDs()
|
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 |
BEST_COMPRESSION
public static final int BEST_COMPRESSION
- The best and slowest compression level. This tries to find very
long and distant string repetitions.
- See Also:
- Constant Field Values
BEST_SPEED
public static final int BEST_SPEED
- The worst but fastest compression level.
- See Also:
- Constant Field Values
DEFAULT_COMPRESSION
public static final int DEFAULT_COMPRESSION
- The default compression level.
- See Also:
- Constant Field Values
NO_COMPRESSION
public static final int NO_COMPRESSION
- This level won't compress at all but output uncompressed blocks.
- See Also:
- Constant Field Values
DEFAULT_STRATEGY
public static final int DEFAULT_STRATEGY
- The default strategy.
- See Also:
- Constant Field Values
FILTERED
public static final int FILTERED
- This strategy will only allow longer string repetitions. It is
useful for random data with a small character set.
- See Also:
- Constant Field Values
HUFFMAN_ONLY
public static final int HUFFMAN_ONLY
- This strategy will not look for string repetitions at all. It
only encodes with Huffman trees (which means, that more common
characters get a smaller encoding.
- See Also:
- Constant Field Values
DEFLATED
public static final int DEFLATED
- The compression method. This is the only method supported so far.
There is no need to use this constant at all.
- See Also:
- Constant Field Values
IS_SETDICT
private static final int IS_SETDICT
- See Also:
- Constant Field Values
IS_FLUSHING
private static final int IS_FLUSHING
- See Also:
- Constant Field Values
IS_FINISHING
private static final int IS_FINISHING
- See Also:
- Constant Field Values
INIT_STATE
private static final int INIT_STATE
- See Also:
- Constant Field Values
SETDICT_STATE
private static final int SETDICT_STATE
- See Also:
- Constant Field Values
INIT_FINISHING_STATE
private static final int INIT_FINISHING_STATE
- See Also:
- Constant Field Values
SETDICT_FINISHING_STATE
private static final int SETDICT_FINISHING_STATE
- See Also:
- Constant Field Values
BUSY_STATE
private static final int BUSY_STATE
- See Also:
- Constant Field Values
FLUSHING_STATE
private static final int FLUSHING_STATE
- See Also:
- Constant Field Values
FINISHING_STATE
private static final int FINISHING_STATE
- See Also:
- Constant Field Values
FINISHED_STATE
private static final int FINISHED_STATE
- See Also:
- Constant Field Values
CLOSED_STATE
private static final int CLOSED_STATE
- See Also:
- Constant Field Values
level
private int level
- Compression level.
noHeader
private boolean noHeader
- should we include a header.
strategy
private int strategy
- Compression strategy.
state
private int state
- The current state.
totalOut
private int totalOut
- The total bytes of output written.
pending
private DeflaterPending pending
- The pending output.
engine
private DeflaterEngine engine
- The deflater engine.
Constructor Detail |
Deflater
public Deflater()
- Creates a new deflater with default compression level.
Deflater
public Deflater(int lvl)
- Creates a new deflater with given compression level.
Deflater
public Deflater(int lvl, boolean nowrap)
- Creates a new deflater with given compression level.
Method Detail |
initIDs
private static void initIDs()
reset
public void reset()
- Resets the deflater. The deflater acts afterwards as if it was
just created with the same compression level and strategy as it
had before.
end
public void end()
- Deprecated. Just clear all references to deflater instead.
- Frees all objects allocated by the compressor. There's no reason to call this, since you can just rely on garbage collection. Exists only for compatibility against Sun's JDK, where the compressor allocates native memory. If you call any method (even reset) afterwards the behaviour is undefined.
- Frees all objects allocated by the compressor. There's no reason to call this, since you can just rely on garbage collection. Exists only for compatibility against Sun's JDK, where the compressor allocates native memory. If you call any method (even reset) afterwards the behaviour is undefined.
getAdler
public int getAdler()
- Gets the current adler checksum of the data that was processed so
far.
getTotalIn
public int getTotalIn()
- Gets the number of input bytes processed so far.
getTotalOut
public int getTotalOut()
- Gets the number of output bytes so far.
finalize
protected void finalize() throws java.lang.Throwable
- Finalizes this object.
flush
void flush()
- Flushes the current input block. Further calls to deflate() will
produce enough output to inflate everything in the current input
block. This is not part of Sun's JDK so I have made it package
private. It is used by DeflaterOutputStream to implement
flush().
finish
public void finish()
- Finishes the deflater with the current input block. It is an error
to give more input after this method was called. This method must
be called to force all bytes to be flushed.
finished
public boolean finished()
- Returns true iff the stream was finished and no more output bytes
are available.
needsInput
public boolean needsInput()
- Returns true, if the input buffer is empty.
You should then call setInput().
NOTE: This method can also return true when the stream was finished.
setInput
public void setInput(byte[] input)
- Sets the data which should be compressed next. This should be only
called when needsInput indicates that more input is needed.
If you call setInput when needsInput() returns false, the
previous input that is still pending will be thrown away.
The given byte array should not be changed, before needsInput() returns
true again.
This call is equivalent to
setInput(input, 0, input.length)
.
setInput
public void setInput(byte[] input, int off, int len)
- Sets the data which should be compressed next. This should be
only called when needsInput indicates that more input is needed.
The given byte array should not be changed, before needsInput() returns
true again.
setLevel
public void setLevel(int lvl)
- Sets the compression level. There is no guarantee of the exact
position of the change, but if you call this when needsInput is
true the change of compression level will occur somewhere near
before the end of the so far given input.
setStrategy
public void setStrategy(int stgy)
- Sets the compression strategy. Strategy is one of
DEFAULT_STRATEGY, HUFFMAN_ONLY and FILTERED. For the exact
position where the strategy is changed, the same as for
setLevel() applies.
deflate
public int deflate(byte[] output)
- Deflates the current input block to the given array. It returns
the number of bytes compressed, or 0 if either
needsInput() or finished() returns true or length is zero.
deflate
public int deflate(byte[] output, int offset, int length)
- Deflates the current input block to the given array. It returns
the number of bytes compressed, or 0 if either
needsInput() or finished() returns true or length is zero.
setDictionary
public void setDictionary(byte[] dict)
- Sets the dictionary which should be used in the deflate process.
This call is equivalent to
setDictionary(dict, 0, dict.length)
.
setDictionary
public void setDictionary(byte[] dict, int offset, int length)
- Sets the dictionary which should be used in the deflate process.
The dictionary should be a byte array containing strings that are
likely to occur in the data which should be compressed. The
dictionary is not stored in the compressed output, only a
checksum. To decompress the output you need to supply the same
dictionary again.
|
|||||||||
Home >> All >> ClassLib >> Common >> java >> util >> [ zip overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |