org.apache.hadoop.hbase.io
Class TagCompressionContext

java.lang.Object
  extended by org.apache.hadoop.hbase.io.TagCompressionContext

@InterfaceAudience.Private
public class TagCompressionContext
extends Object

Context that holds the dictionary for Tag compression and doing the compress/uncompress. This will be used for compressing tags while writing into HFiles and WALs.


Constructor Summary
TagCompressionContext(Class<? extends Dictionary> dictType, int dictCapacity)
           
 
Method Summary
 void clear()
           
 void compressTags(OutputStream out, byte[] in, int offset, int length)
          Compress tags one by one and writes to the OutputStream.
 void compressTags(OutputStream out, ByteBuffer in, int length)
          Compress tags one by one and writes to the OutputStream.
 int uncompressTags(ByteBuffer src, byte[] dest, int offset, int length)
          Uncompress tags from the input ByteBuffer and writes to the destination array.
 void uncompressTags(InputStream src, byte[] dest, int offset, int length)
          Uncompress tags from the InputStream and writes to the destination array.
 void uncompressTags(InputStream src, ByteBuffer dest, int length)
          Uncompress tags from the InputStream and writes to the destination buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagCompressionContext

public TagCompressionContext(Class<? extends Dictionary> dictType,
                             int dictCapacity)
                      throws SecurityException,
                             NoSuchMethodException,
                             InstantiationException,
                             IllegalAccessException,
                             InvocationTargetException
Throws:
SecurityException
NoSuchMethodException
InstantiationException
IllegalAccessException
InvocationTargetException
Method Detail

clear

public void clear()

compressTags

public void compressTags(OutputStream out,
                         byte[] in,
                         int offset,
                         int length)
                  throws IOException
Compress tags one by one and writes to the OutputStream.

Parameters:
out - Stream to which the compressed tags to be written
in - Source where tags are available
offset - Offset for the tags bytes
length - Length of all tag bytes
Throws:
IOException

compressTags

public void compressTags(OutputStream out,
                         ByteBuffer in,
                         int length)
                  throws IOException
Compress tags one by one and writes to the OutputStream.

Parameters:
out - Stream to which the compressed tags to be written
in - Source buffer where tags are available
length - Length of all tag bytes
Throws:
IOException

uncompressTags

public void uncompressTags(InputStream src,
                           byte[] dest,
                           int offset,
                           int length)
                    throws IOException
Uncompress tags from the InputStream and writes to the destination array.

Parameters:
src - Stream where the compressed tags are available
dest - Destination array where to write the uncompressed tags
offset - Offset in destination where tags to be written
length - Length of all tag bytes
Throws:
IOException

uncompressTags

public int uncompressTags(ByteBuffer src,
                          byte[] dest,
                          int offset,
                          int length)
                   throws IOException
Uncompress tags from the input ByteBuffer and writes to the destination array.

Parameters:
src - Buffer where the compressed tags are available
dest - Destination array where to write the uncompressed tags
offset - Offset in destination where tags to be written
length - Length of all tag bytes
Returns:
bytes count read from source to uncompress all tags.
Throws:
IOException

uncompressTags

public void uncompressTags(InputStream src,
                           ByteBuffer dest,
                           int length)
                    throws IOException
Uncompress tags from the InputStream and writes to the destination buffer.

Parameters:
src - Stream where the compressed tags are available
dest - Destination buffer where to write the uncompressed tags
length - Length of all tag bytes
Throws:
IOException


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.