org.apache.hadoop.hbase.io.encoding
Class EncodedDataBlock

java.lang.Object
  extended by org.apache.hadoop.hbase.io.encoding.EncodedDataBlock

public class EncodedDataBlock
extends Object

Encapsulates a data block compressed using a particular encoding algorithm. Useful for testing and benchmarking.


Field Summary
protected  DataBlockEncoder dataBlockEncoder
           
 
Constructor Summary
EncodedDataBlock(DataBlockEncoder dataBlockEncoder, boolean includesMemstoreTS)
          Create a buffer which will be encoded using dataBlockEncoder.
 
Method Summary
 void addKv(KeyValue kv)
          Add KeyValue and compress it.
 int checkCompressedSize(org.apache.hadoop.io.compress.Compressor compressor)
          Estimate size after second stage of compression (e.g.
static int checkCompressedSize(org.apache.hadoop.io.compress.Compressor compressor, byte[] buffer, int offset, int length)
          Find the size of compressed data assuming that buffer will be compressed using given algorithm.
 byte[] doCompressData()
          Do the compression.
 Iterator<KeyValue> getIterator()
          Provides access to compressed value.
 byte[] getRawKeyValues()
          Get uncompressed buffer.
 int getSize()
          Find the size of minimal buffer that could store compressed data.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dataBlockEncoder

protected DataBlockEncoder dataBlockEncoder
Constructor Detail

EncodedDataBlock

public EncodedDataBlock(DataBlockEncoder dataBlockEncoder,
                        boolean includesMemstoreTS)
Create a buffer which will be encoded using dataBlockEncoder.

Parameters:
dataBlockEncoder - Algorithm used for compression.
Method Detail

addKv

public void addKv(KeyValue kv)
Add KeyValue and compress it.

Parameters:
kv - Item to be added and compressed.

getIterator

public Iterator<KeyValue> getIterator()
Provides access to compressed value.

Returns:
Forwards sequential iterator.

getSize

public int getSize()
Find the size of minimal buffer that could store compressed data.

Returns:
Size in bytes of compressed data.

checkCompressedSize

public static int checkCompressedSize(org.apache.hadoop.io.compress.Compressor compressor,
                                      byte[] buffer,
                                      int offset,
                                      int length)
Find the size of compressed data assuming that buffer will be compressed using given algorithm.

Parameters:
compressor - Algorithm used for compression.
buffer - Array to be compressed.
offset - Offset to beginning of the data.
length - Length to be compressed.
Returns:
Size of compressed data in bytes.

checkCompressedSize

public int checkCompressedSize(org.apache.hadoop.io.compress.Compressor compressor)
Estimate size after second stage of compression (e.g. LZO).

Parameters:
compressor - Algorithm which will be used for compressions.
Returns:
Size after second stage of compression.

doCompressData

public byte[] doCompressData()
Do the compression.

Returns:
Compressed byte buffer.

toString

public String toString()
Overrides:
toString in class Object

getRawKeyValues

public byte[] getRawKeyValues()
Get uncompressed buffer.

Returns:
The buffer.


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.