| org.apache.mina.filter.util.WriteRequestFilter org.apache.mina.filter.compression.CompressionFilter
CompressionFilter | public class CompressionFilter extends WriteRequestFilter (Code) | | An
IoFilter which compresses all data using
JZlib.
Support for the LZW (DLCZ) algorithm is also planned.
This filter only supports compression using the PARTIAL FLUSH method,
since that is the only method useful when doing stream level compression.
This filter supports compression/decompression of the input and output
channels selectively. It can also be enabled/disabled on the fly.
This filter does not discard the zlib objects, keeping them around for the
entire life of the filter. This is because the zlib dictionary needs to
be built up over time, which is used during compression and decompression.
Over time, as repetitive data is sent over the wire, the compression efficiency
steadily increases.
Note that the zlib header is written only once. It is not necessary that
the data received after processing by this filter may not be complete due
to packet fragmentation.
It goes without saying that the other end of this stream should also have a
compatible compressor/decompressor using the same algorithm.
author: The Apache MINA Project (dev@mina.apache.org) version: $Rev: 581234 $, $Date: 2007-10-02 07:39:48 -0600 (Tue, 02 Oct 2007) $ |
Constructor Summary | |
public | CompressionFilter() Creates a new instance which compresses outboud data and decompresses
inbound data with default compression level. | public | CompressionFilter(int compressionLevel) Creates a new instance which compresses outboud data and decompresses
inbound data with the specified compressionLevel.
Parameters: compressionLevel - the level of compression to be used. | public | CompressionFilter(boolean compressInbound, boolean compressOutbound, int compressionLevel) Creates a new instance.
Parameters: compressInbound - true if data read is to be decompressed Parameters: compressOutbound - true if data written is to be compressed Parameters: compressionLevel - the level of compression to be used. |
COMPRESSION_DEFAULT | final public static int COMPRESSION_DEFAULT(Code) | | The default compression level used. Provides the best balance
between speed and compression
|
COMPRESSION_MAX | final public static int COMPRESSION_MAX(Code) | | Max compression level. Will give the highest compression ratio, but
will also take more cpu time and is the slowest.
|
COMPRESSION_MIN | final public static int COMPRESSION_MIN(Code) | | Provides the best speed at the price of a low compression ratio.
|
COMPRESSION_NONE | final public static int COMPRESSION_NONE(Code) | | No compression done on the data.
|
DISABLE_COMPRESSION_ONCE | final public static AttributeKey DISABLE_COMPRESSION_ONCE(Code) | | A flag that allows you to disable compression once.
|
CompressionFilter | public CompressionFilter()(Code) | | Creates a new instance which compresses outboud data and decompresses
inbound data with default compression level.
|
isCompressInbound | public boolean isCompressInbound()(Code) | | Returns true if incoming data is being compressed.
|
isCompressOutbound | public boolean isCompressOutbound()(Code) | | Returns true if the filter is compressing data being written.
|
setCompressInbound | public void setCompressInbound(boolean compressInbound)(Code) | | Sets if incoming data has to be compressed.
|
setCompressOutbound | public void setCompressOutbound(boolean compressOutbound)(Code) | | Set if outgoing data has to be compressed.
|
|
|