|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.zip.Deflater
public class Deflater
The Deflater class is used to compress bytes using the DEFLATE compression algorithm. Deflation is performed by the ZLIB compression library.
DeflaterOutputStream,
Inflater| Field Summary | |
|---|---|
static int |
BEST_COMPRESSION
|
static int |
BEST_SPEED
|
static int |
DEFAULT_COMPRESSION
|
static int |
DEFAULT_STRATEGY
|
static int |
DEFLATED
|
static int |
FILTERED
|
static int |
HUFFMAN_ONLY
|
static int |
NO_COMPRESSION
|
| Constructor Summary | |
|---|---|
Deflater()
Constructs a new Deflater instance with default compression level and strategy. |
|
Deflater(int level)
Constructs a new Deflater instance with compression level level and default compression strategy. |
|
Deflater(int level,
boolean noHeader)
Constructs a new Deflater instance with compression level level and default compression strategy. |
|
| Method Summary | |
|---|---|
int |
deflate(byte[] buf)
Deflates data into the supplied buffer |
int |
deflate(byte[] buf,
int off,
int nbytes)
Deflates data into the supplied buffer using the region from off to nbytes - 1. |
void |
end()
Frees all resources held onto by this Deflater. |
protected void |
finalize()
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. |
void |
finish()
Indicates to the Deflater that all uncompressed input has been provided to it. |
boolean |
finished()
Returns whether or not all provided data has been successfully compressed. |
int |
getAdler()
Returns the Adler32 checksum of uncompressed data currently read. |
long |
getBytesRead()
Returns a long int of total number of bytes read by the Deflater. |
long |
getBytesWritten()
Returns a long int of total number of bytes of read by the Deflater. |
int |
getTotalIn()
Returns the total number of bytes of input consumed by the deflater. |
int |
getTotalOut()
Returns the total number of compressed bytes output by this Deflater. |
boolean |
needsInput()
Indicates whether or not all bytes of uncompressed input have been consumed by the Deflater. |
void |
reset()
Resets the Deflater to accept new input without affecting
any previously made settings for the compression strategy or level. |
void |
setDictionary(byte[] buf)
|
void |
setDictionary(byte[] buf,
int off,
int nbytes)
Sets the dictionary to be used for compression by this Deflater. |
void |
setInput(byte[] buf)
Sets the input buffer the Deflater will use to extract uncompressed bytes for later compression. |
void |
setInput(byte[] buf,
int off,
int nbytes)
Sets the input buffer the Deflater will use to extract uncompressed bytes for later compression. |
void |
setLevel(int level)
Sets the compression level to be used when compressing data. |
void |
setStrategy(int strategy)
Sets the compression strategy to be used. |
| 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 DEFAULT_STRATEGY
public static final int DEFLATED
public static final int FILTERED
public static final int HUFFMAN_ONLY
public static final int NO_COMPRESSION
| Constructor Detail |
|---|
public Deflater()
public Deflater(int level)
level - the compression level to use
public Deflater(int level,
boolean noHeader)
level - the compression level to usenoHeader - if true do not write the ZLIB header| Method Detail |
|---|
public int deflate(byte[] buf)
buf - buffer to store compressed data
public int deflate(byte[] buf,
int off,
int nbytes)
buf - buffer to store compressed dataoff - offset inf buf to start storing datanbytes - number of bytes of compressed data to store in buf
public void end()
finalize()protected void finalize()
ObjectNote: The virtual machine assumes that the implementation in class Object is empty.
finalize in class Objectpublic void finish()
finishedpublic boolean finished()
public int getAdler()
setDictionary(byte[]),
setDictionary(byte[], int, int)public int getTotalIn()
public int getTotalOut()
public boolean needsInput()
finished(),
setInput(byte[]),
setInput(byte[], int, int)public void reset()
Deflater to accept new input without affecting
any previously made settings for the compression strategy or level. This
operation must be called after finished() returns
true if the Deflater is to be reused.
finishedpublic void setDictionary(byte[] buf)
public void setDictionary(byte[] buf,
int off,
int nbytes)
Deflater(int, boolean)public void setInput(byte[] buf)
public void setInput(byte[] buf,
int off,
int nbytes)
public void setLevel(int level)
level - compression level to use
IllegalArgumentException - If the compression level is invalid.public void setStrategy(int strategy)
strategy - compression strategy to use
IllegalArgumentException - If the strategy specified is not one of FILTERED,
HUFFMAN_ONLY or DEFAULT_STRATEGY.public long getBytesRead()
public long getBytesWritten()
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||