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

java.lang.Object
  extended by org.apache.hadoop.hbase.io.encoding.CopyKeyDataBlockEncoder
All Implemented Interfaces:
DataBlockEncoder

public class CopyKeyDataBlockEncoder
extends Object

Just copy data, do not do any kind of compression. Use for comparison and benchmarking.


Nested Class Summary
protected static class BufferedDataBlockEncoder.BufferedEncodedSeeker<STATE extends BufferedDataBlockEncoder.SeekerState>
           
protected static class BufferedDataBlockEncoder.SeekerState
           
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.io.encoding.DataBlockEncoder
DataBlockEncoder.EncodedSeeker
 
Constructor Summary
CopyKeyDataBlockEncoder()
           
 
Method Summary
protected  void afterDecodingKeyValue(DataInputStream source, ByteBuffer dest, boolean includesMemstoreTS)
           
protected  void afterEncodingKeyValue(ByteBuffer in, DataOutputStream out, boolean includesMemstoreTS)
           
 void compressKeyValues(DataOutputStream out, ByteBuffer in, boolean includesMemstoreTS)
          Compress KeyValues and write them to output buffer.
 DataBlockEncoder.EncodedSeeker createSeeker(org.apache.hadoop.io.RawComparator<byte[]> comparator, boolean includesMemstoreTS)
          Create a HFileBlock seeker which find KeyValues within a block.
 ByteBuffer getFirstKeyInBlock(ByteBuffer block)
          Return first key in block.
 String toString()
           
 ByteBuffer uncompressKeyValues(DataInputStream source, boolean includesMemstoreTS)
          Uncompress.
 ByteBuffer uncompressKeyValues(DataInputStream source, int preserveHeaderLength, int skipLastBytes, boolean includesMemstoreTS)
          Uncompress.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CopyKeyDataBlockEncoder

public CopyKeyDataBlockEncoder()
Method Detail

compressKeyValues

public void compressKeyValues(DataOutputStream out,
                              ByteBuffer in,
                              boolean includesMemstoreTS)
                       throws IOException
Description copied from interface: DataBlockEncoder
Compress KeyValues and write them to output buffer.

Parameters:
out - Where to write compressed data.
in - Source of KeyValue for compression.
includesMemstoreTS - true if including memstore timestamp after every key-value pair
Throws:
IOException - If there is an error writing to output stream.

uncompressKeyValues

public ByteBuffer uncompressKeyValues(DataInputStream source,
                                      int preserveHeaderLength,
                                      int skipLastBytes,
                                      boolean includesMemstoreTS)
                               throws IOException
Description copied from interface: DataBlockEncoder
Uncompress.

Parameters:
source - Compressed stream of KeyValues.
preserveHeaderLength - allocate this many bytes for the header.
skipLastBytes - Do not copy n last bytes.
includesMemstoreTS - true if including memstore timestamp after every key-value pair
Returns:
Uncompressed block of KeyValues.
Throws:
IOException - If there is an error in source.

getFirstKeyInBlock

public ByteBuffer getFirstKeyInBlock(ByteBuffer block)
Description copied from interface: DataBlockEncoder
Return first key in block. Useful for indexing. Typically does not make a deep copy but returns a buffer wrapping a segment of the actual block's byte array. This is because the first key in block is usually stored unencoded.

Parameters:
block - encoded block we want index, the position will not change
Returns:
First key in block.

toString

public String toString()
Overrides:
toString in class Object

createSeeker

public DataBlockEncoder.EncodedSeeker createSeeker(org.apache.hadoop.io.RawComparator<byte[]> comparator,
                                                   boolean includesMemstoreTS)
Description copied from interface: DataBlockEncoder
Create a HFileBlock seeker which find KeyValues within a block.

Parameters:
comparator - what kind of comparison should be used
includesMemstoreTS - true if including memstore timestamp after every key-value pair
Returns:
A newly created seeker.

uncompressKeyValues

public ByteBuffer uncompressKeyValues(DataInputStream source,
                                      boolean includesMemstoreTS)
                               throws IOException
Description copied from interface: DataBlockEncoder
Uncompress.

Specified by:
uncompressKeyValues in interface DataBlockEncoder
Parameters:
source - Compressed stream of KeyValues.
includesMemstoreTS - true if including memstore timestamp after every key-value pair
Returns:
Uncompressed block of KeyValues.
Throws:
IOException - If there is an error in source.

afterEncodingKeyValue

protected final void afterEncodingKeyValue(ByteBuffer in,
                                           DataOutputStream out,
                                           boolean includesMemstoreTS)

afterDecodingKeyValue

protected final void afterDecodingKeyValue(DataInputStream source,
                                           ByteBuffer dest,
                                           boolean includesMemstoreTS)


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