Buffer using the LZF format.
See original LZF package and LZF format for full description.
| Modifier and Type | Class and Description |
|---|---|
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private final int | compressThreshold
Compress threshold for LZF format. |
| private final ChunkEncoder | encoder
Underlying decoder in use. |
| private static final int | MIN_BLOCK_TO_COMPRESS
Minimum block size ready for compression. |
| private final BufferRecycler | recycler
Object that handles details of buffer recycling. |
| private LzfCompressor. |
| Access | Constructor and Description |
|---|---|
| private | LzfCompressor(boolean
If safeInstance, int true encoder will use ChunkEncoder that only uses standard
JDK access methods, and should work on all Java platforms and JVMs.
Otherwise encoder will try to use highly optimized ChunkEncoder
implementation that uses Sun JDK's sun.
class (which may be included by other JDK's as well).Expected total length of content to compress; only matters for outgoing messages
that is smaller than maximum chunk size (64k), to optimize encoding hash tables. totalLength, int Compress threshold for LZF format. When the amount of input data is less than
compressThreshold, we will construct an uncompressed output according
to the LZF format. compressThreshold)Creates a new LZF compressor with specified settings. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public Buffer | compress(Buffer
the in, BufferAllocator Buffer that contains the data to be compressed.the allocator)BufferAllocator that is used to allocate a new buffer (if needed) to write the
compressed bytes too.Implements io. Buffer and compress into a new Buffer that will be
allocated (if needed) from the BufferAllocator.
|
| private int | |
| private static int | encodeNonCompress(byte[] input, int inputPtr, int length, byte[] output, int outputPtr)
Use lzf uncompressed format to encode a piece of input. |
| public Buffer | finish(BufferAllocator allocator)
Implements io. |
| public boolean | isClosed()
Implements io. true if the decompressor was closed, false otherwise.
|
| public boolean | isFinished()
Implements io. true if the compressor was finished or closed.
|
| private static int | |
| public static Supplier | Returns: the factory.Creates a new LZF compressor factory with the most optimal available methods for underlying data access. |
| public static Supplier | Returns: the factory.If safeInstance)true encoder will use ChunkEncoder that only uses
standard JDK access methods, and should work on all Java platforms and JVMs.
Otherwise encoder will try to use highly optimized ChunkEncoder
implementation that uses Sun JDK's sun.
class (which may be included by other JDK's as well).Creates a new LZF compressor factory with specified encoding instance. |
| public static Supplier | Returns: the factory.If safeInstance, int true encoder will use ChunkEncoder that only uses standard
JDK access methods, and should work on all Java platforms and JVMs.
Otherwise encoder will try to use highly optimized ChunkEncoder
implementation that uses Sun JDK's sun.
class (which may be included by other JDK's as well).Expected total length of content to compress; only matters for outgoing messages
that is smaller than maximum chunk size (64k), to optimize encoding hash tables. totalLength)Creates a new LZF compressor factory with specified encoding instance and compressThreshold. |
| public static Supplier | Returns: the factory.Expected total length of content to compress;
only matters for outgoing messages that is smaller than maximum chunk size (64k),
to optimize encoding hash tables. totalLength)Creates a new LZF compressor factory with specified total length of encoded chunk. |
| public static Supplier | Returns: the factory.If safeInstance, int true encoder will use ChunkEncoder that only uses standard JDK
access methods, and should work on all Java platforms and JVMs.
Otherwise encoder will try to use highly optimized ChunkEncoder
implementation that uses Sun JDK's sun.
class (which may be included by other JDK's as well).Expected total length of content to compress; only matters for outgoing messages
that is smaller than maximum chunk size (64k), to optimize encoding hash tables. totalLength, int Compress threshold for LZF format. When the amount of input data is less than
compressThreshold, we will construct an uncompressed output according
to the LZF format. compressThreshold)Creates a new LZF compressor factory with specified settings. |
| compressThreshold | back to summary |
|---|---|
| private final int compressThreshold Compress threshold for LZF format. When the amount of input data is less than compressThreshold, we will construct an uncompressed output according to the LZF format.
When the value is less than
| |
| encoder | back to summary |
|---|---|
| private final ChunkEncoder encoder Underlying decoder in use. | |
| MIN_BLOCK_TO_COMPRESS | back to summary |
|---|---|
| private static final int MIN_BLOCK_TO_COMPRESS Minimum block size ready for compression. Blocks with length
less than | |
| recycler | back to summary |
|---|---|
| private final BufferRecycler recycler Object that handles details of buffer recycling. | |
| state | back to summary |
|---|---|
| private LzfCompressor. | |
| LzfCompressor | back to summary |
|---|---|
| private LzfCompressor(boolean safeInstance, int totalLength, int compressThreshold) Creates a new LZF compressor with specified settings.
| |
| close | back to summary |
|---|---|
| public void close() Implements io. Doc from io. #
Close the compressor. After this method was called
| |
| compress | back to summary |
|---|---|
| public Buffer compress(Buffer in, BufferAllocator allocator) throws CompressionException Implements io. Doc from io. This method will read from the input
| |
| encodeCompress | back to summary |
|---|---|
| private int encodeCompress(byte[] input, int inputPtr, int length, byte[] output, int outputPtr) | |
| encodeNonCompress | back to summary |
|---|---|
| private static int encodeNonCompress(byte[] input, int inputPtr, int length, byte[] output, int outputPtr) Use lzf uncompressed format to encode a piece of input. | |
| finish | back to summary |
|---|---|
| public Buffer finish(BufferAllocator allocator) Implements io. Doc from io. By calling this method we signal that the compression stream is marked as finish. The returned | |
| isClosed | back to summary |
|---|---|
| public boolean isClosed() Implements io. Doc from io. Return
| |
| isFinished | back to summary |
|---|---|
| public boolean isFinished() Implements io. Doc from io. Returns
| |
| lzfEncodeNonCompress | back to summary |
|---|---|
| private static int lzfEncodeNonCompress(byte[] input, int inputPtr, int length, byte[] output, int outputPtr) | |
| newFactory | back to summary |
|---|---|
| public static Supplier Creates a new LZF compressor factory with the most optimal available methods for underlying data access.
It will "unsafe" instance if one can be used on current JVM.
It should be safe to call this constructor as implementations are dynamically loaded; however, on some
non-standard platforms it may be necessary to use
| |
| newFactory | back to summary |
|---|---|
| public static Supplier Creates a new LZF compressor factory with specified encoding instance.
| |
| newFactory | back to summary |
|---|---|
| public static Supplier Creates a new LZF compressor factory with specified encoding instance and compressThreshold.
| |
| newFactory | back to summary |
|---|---|
| public static Supplier Creates a new LZF compressor factory with specified total length of encoded chunk. You can configure it to encode your data flow more efficient if you know the average size of messages that you send.
| |
| newFactory | back to summary |
|---|---|
| public static Supplier Creates a new LZF compressor factory with specified settings.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final LzfCompressor. | |
| public static final LzfCompressor. | |
| public static final LzfCompressor. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static LzfCompressor. | |
| public static LzfCompressor. |
| CLOSED | back to summary |
|---|---|
| public static final LzfCompressor. | |
| FINISHED | back to summary |
|---|---|
| public static final LzfCompressor. | |
| PROCESSING | back to summary |
|---|---|
| public static final LzfCompressor. | |
| State | back to summary |
|---|---|
| private State() | |
| valueOf | back to summary |
|---|---|
| public static LzfCompressor. | |
| values | back to summary |
|---|---|
| public static LzfCompressor. | |