|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.atmosphere.gwt.server.deflate.Deflater
public final class Deflater
This class implements the core DEFLATE process, i.e. the compression of data into DEFLATE blocks.
| Field Summary | |
|---|---|
static int |
COMPACT
Compression level 4: try to achieve best compression ratio, possibly at the expense of compression speed. |
static int |
HUFF
Compression level 1: do not apply LZ77; only Huffman codes are computed. |
static int |
MEDIUM
Compression level 3: compromise between speed and compression ratio. |
static int |
SPEED
Compression level 2: optimize for speed. |
| Constructor Summary | |
|---|---|
Deflater()
Build a deflater with the default parameters ( MEDIUM level, 15-bit window). |
|
Deflater(int level)
Build a deflater with the provided compression strategy (either SPEED, MEDIUM or
COMPACT). |
|
Deflater(int level,
int windowBits)
Build a deflater with the provided compression strategy (either SPEED, MEDIUM or
COMPACT) and the provided window size. |
|
| Method Summary | |
|---|---|
void |
flushSync(boolean withData)
Perform a "sync flush" in a way similar to what is done by zlib with option Z_SYNC_FLUSH. |
OutputStream |
getOut()
Get the current output transport stream. |
void |
process(byte[] buf,
int off,
int len)
Process some more data. |
void |
setOut(OutputStream out)
Set the current output transport stream. |
void |
terminate()
Terminate the current compression run. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int HUFF
SPEED
but with a degraded compression ratio.
public static final int SPEED
public static final int MEDIUM
public static final int COMPACT
MEDIUM level.
| Constructor Detail |
|---|
public Deflater()
MEDIUM level, 15-bit window).
public Deflater(int level)
SPEED, MEDIUM or
COMPACT). A standard 15-bit window is used. If the compression level is 0, then the default
compression level is selected.
level - the compression strategy
public Deflater(int level,
int windowBits)
SPEED, MEDIUM or
COMPACT) and the provided window size. The window size is expressed in bits and may range from 9 to
15 (inclusive). The DEFLATE format uses a 15-bit window; by using a smaller window, the produced stream can be
inflated with less memory (but compression ratio is lowered). If the compression level is 0, then the default
compression level is selected.
level - the compression strategywindowBits - the window bit size (9 to 15)| Method Detail |
|---|
public OutputStream getOut()
public void setOut(OutputStream out)
out - the new transport stream
public void process(byte[] buf,
int off,
int len)
throws IOException
buf - the data bufferoff - the data offsetlen - the data length (in bytes)
IOException - on I/O error with the transport stream
public void terminate()
throws IOException
IOException - on I/O error with the transport stream
public void flushSync(boolean withData)
throws IOException
Z_SYNC_FLUSH. The
current block, if any, is closed, and one empty type 0 block is added. After this call, the stream is
byte-aligned. The type 0 block ends with the aligned four-byte sequence 00 00 FF FF; these four bytes are omitted
if withData is false. The transport stream is NOT flushed.
withData - false to omit the 00 00 FF FF bytes
IOException - on I/O error with the transport stream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||