Class CompressLZF
- java.lang.Object
-
- org.mapdb.CompressLZF
-
public final class CompressLZF extends java.lang.ObjectThis class implements the LZF lossless data compression algorithm. LZF is a Lempel-Ziv variant with byte-aligned output, and optimized for speed.
Safety/Use Notes:
- Each instance should be used by a single thread only.
- The data buffers should be smaller than 1 GB.
- For performance reasons, safety checks on expansion are omitted.
- Invalid compressed data can cause an ArrayIndexOutOfBoundsException.
The LZF compressed format knows literal runs and back-references:
- Literal run: directly copy bytes from input to output.
- Back-reference: copy previous data to output stream, with specified offset from location and length. The length is at least 3 bytes.
The first byte of the compressed stream is the control byte. For literal runs, the highest three bits of the control byte are not set, the the lower bits are the literal run length, and the next bytes are data to copy directly into the output. For back-references, the highest three bits of the control byte are the back-reference length. If all three bits are set, then the back-reference length is stored in the next byte. The lower bits of the control byte combined with the next byte form the offset for the back-reference.
-
-
Constructor Summary
Constructors Constructor and Description CompressLZF()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcompress(byte[] in, int inLen, byte[] out, int outPos)voidexpand(byte[] in, int inPos, byte[] out, int outPos, int outLen)voidexpand(java.nio.ByteBuffer in, int inPos, byte[] out, int outPos, int outLen)voidexpand(java.io.DataInput in, byte[] out, int outPos, int outLen)
-
-
-
Method Detail
-
compress
public int compress(byte[] in, int inLen, byte[] out, int outPos)
-
expand
public void expand(java.io.DataInput in, byte[] out, int outPos, int outLen) throws java.io.IOException- Throws:
java.io.IOException
-
expand
public void expand(java.nio.ByteBuffer in, int inPos, byte[] out, int outPos, int outLen)
-
expand
public void expand(byte[] in, int inPos, byte[] out, int outPos, int outLen)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG