org.elasticsearch.common.compress.lzf.impl
Class UnsafeChunkDecoder
java.lang.Object
org.elasticsearch.common.compress.lzf.ChunkDecoder
org.elasticsearch.common.compress.lzf.impl.UnsafeChunkDecoder
public class UnsafeChunkDecoder
- extends ChunkDecoder
Highly optimized 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.
Method Summary |
void |
decodeChunk(byte[] in,
int inPos,
byte[] out,
int outPos,
int outEnd)
Main decode method for individual chunks. |
int |
decodeChunk(java.io.InputStream is,
byte[] inputBuffer,
byte[] outputBuffer)
Main decode from a stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UnsafeChunkDecoder
public UnsafeChunkDecoder()
decodeChunk
public final int decodeChunk(java.io.InputStream is,
byte[] inputBuffer,
byte[] outputBuffer)
throws java.io.IOException
- Description copied from class:
ChunkDecoder
- Main decode from a stream. Decompressed bytes are placed in the outputBuffer, inputBuffer
is a "scratch-area".
- Specified by:
decodeChunk
in class ChunkDecoder
- Parameters:
is
- An input stream of LZF compressed bytesinputBuffer
- A byte array used as a scratch area.outputBuffer
- A byte array in which the result is returned
- Returns:
- The number of bytes placed in the outputBuffer.
- Throws:
java.io.IOException
decodeChunk
public final void decodeChunk(byte[] in,
int inPos,
byte[] out,
int outPos,
int outEnd)
throws java.io.IOException
- Description copied from class:
ChunkDecoder
- Main decode method for individual chunks.
- Specified by:
decodeChunk
in class ChunkDecoder
- Throws:
java.io.IOException