org.elasticsearch.common.compress.lzf
Class ChunkEncoder

java.lang.Object
  extended by org.elasticsearch.common.compress.lzf.ChunkEncoder

public class ChunkEncoder
extends java.lang.Object

Class that handles actual encoding of individual chunks. Resulting chunks can be compressed or non-compressed; compression is only used if it actually reduces chunk size (including overhead of additional header bytes)


Constructor Summary
ChunkEncoder(int totalLength, BufferRecycler recycler)
           
 
Method Summary
 void close()
          Method to close once encoder is no longer in use.
 void encodeAndWriteChunk(byte[] data, int offset, int len, java.io.OutputStream out)
          Method for encoding individual chunk, writing it to given output stream.
 LZFChunk encodeChunk(byte[] data, int offset, int len)
          Method for compressing (or not) individual chunks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkEncoder

public ChunkEncoder(int totalLength,
                    BufferRecycler recycler)
Parameters:
totalLength - Total encoded length; used for calculating size of hash table to use
Method Detail

close

public void close()
Method to close once encoder is no longer in use. Note: after calling this method, further calls to #_encodeChunk will fail


encodeChunk

public LZFChunk encodeChunk(byte[] data,
                            int offset,
                            int len)
Method for compressing (or not) individual chunks


encodeAndWriteChunk

public void encodeAndWriteChunk(byte[] data,
                                int offset,
                                int len,
                                java.io.OutputStream out)
                         throws java.io.IOException
Method for encoding individual chunk, writing it to given output stream.

Throws:
java.io.IOException