ChunkDecoder implementation that uses
Sun JDK's Unsafe class (which may be included by other JDK's as well;
IBM's apparently does).
Credits for the idea go to Dain Sundstrom, who kindly suggested this use, and is all-around great source for optimization tips and tricks. Big thanks also to LZ4-java developers, whose stellar performance made me go back and see what more I can do to optimize this code!
| Modifier and Type | Field and Description |
|---|---|
| private static final long | |
| private static final Unsafe |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static final void | |
| private static final void | |
| private static final int | |
| private final int | |
| private static final void | |
| private static final void | |
| public final int | decodeChunk(final InputStream
An input stream of LZF compressed bytes is, final byte[] A byte array used as a scratch area. inputBuffer, final byte[] A byte array in which the result is returned outputBuffer)Implements abstract com. |
| public final void | decodeChunk(byte[] in, int inPos, byte[] out, int outPos, int outEnd)
Implements abstract com. |
| public int | skipOrDecodeChunk(final InputStream is, final byte[] inputBuffer, final byte[] outputBuffer, final long maxToSkip)
Implements abstract com. |
| BYTE_ARRAY_OFFSET | back to summary |
|---|---|
| private static final long BYTE_ARRAY_OFFSET | |
| unsafe | back to summary |
|---|---|
| private static final Unsafe unsafe | |
| UnsafeChunkDecoder | back to summary |
|---|---|
| public UnsafeChunkDecoder() | |
| copyLong | back to summary |
|---|---|
| private static final void copyLong(byte[] buffer, int inputIndex, int outputIndex, int length, int outputEnd8) | |
| copyLongTail | back to summary |
|---|---|
| private static final void copyLongTail(byte[] buffer, int inputIndex, int outputIndex, int length) | |
| copyOverlappingLong | back to summary |
|---|---|
| private static final int copyOverlappingLong(final byte[] out, int outPos, final int offset, int len) | |
| copyOverlappingShort | back to summary |
|---|---|
| private final int copyOverlappingShort(final byte[] out, int outPos, final int offset, int len) | |
| copyUpTo32 | back to summary |
|---|---|
| private static final void copyUpTo32(byte[] buffer, int inputIndex, int outputIndex, int lengthMinusOne) | |
| copyUpTo32 | back to summary |
|---|---|
| private static final void copyUpTo32(byte[] in, int inputIndex, byte[] out, int outputIndex, int lengthMinusOne) | |
| decodeChunk | back to summary |
|---|---|
| public final int decodeChunk(final InputStream is, final byte[] inputBuffer, final byte[] outputBuffer) throws IOException Implements abstract com. Doc from com. Main decode from a stream. Decompressed bytes are placed in the outputBuffer, inputBuffer is a "scratch-area".
| |
| decodeChunk | back to summary |
|---|---|
| public final void decodeChunk(byte[] in, int inPos, byte[] out, int outPos, int outEnd) throws LZFException Implements abstract com. Doc from com. Main decode method for individual chunks.
| |
| skipOrDecodeChunk | back to summary |
|---|---|
| public int skipOrDecodeChunk(final InputStream is, final byte[] inputBuffer, final byte[] outputBuffer, final long maxToSkip) throws IOException Implements abstract com.
| |