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

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

@InterfaceAudience.Private
public class HFileBlockDefaultEncodingContext
extends Object
implements HFileBlockEncodingContext

A default implementation of HFileBlockEncodingContext. It will compress the data section as one continuous buffer.

See Also:
for the decompression part

Constructor Summary
HFileBlockDefaultEncodingContext(DataBlockEncoding encoding, byte[] headerBytes, HFileContext fileContext)
           
 
Method Summary
 void close()
          Releases the compressor this writer uses to compress blocks into the compressor pool.
protected  void compressAfterEncoding(byte[] uncompressedBytesWithHeader, BlockType blockType, byte[] headerBytes)
           
 void compressAfterEncodingWithBlockType(byte[] uncompressedBytesWithHeader, BlockType blockType)
           
 BlockType getBlockType()
           
 DataBlockEncoding getDataBlockEncoding()
           
 HFileContext getHFileContext()
           
 byte[] getOnDiskBytesWithHeader()
           
 DataOutputStream getOutputStreamForEncoder()
           
 TagCompressionContext getTagCompressionContext()
           
 byte[] getUncompressedBytesWithHeader()
           
 void postEncoding(BlockType blockType)
          Do any action that needs to be performed after the encoding.
 void prepareEncoding()
          prepare to start a new encoding.
 void setDummyHeader(byte[] headerBytes)
          sets the dummy header bytes
 void setTagCompressionContext(TagCompressionContext tagCompressionContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HFileBlockDefaultEncodingContext

public HFileBlockDefaultEncodingContext(DataBlockEncoding encoding,
                                        byte[] headerBytes,
                                        HFileContext fileContext)
Parameters:
encoding - encoding used
headerBytes - dummy header bytes
fileContext - HFile meta data
Method Detail

setDummyHeader

public void setDummyHeader(byte[] headerBytes)
Description copied from interface: HFileBlockEncodingContext
sets the dummy header bytes

Specified by:
setDummyHeader in interface HFileBlockEncodingContext

prepareEncoding

public void prepareEncoding()
                     throws IOException
prepare to start a new encoding.

Throws:
IOException

postEncoding

public void postEncoding(BlockType blockType)
                  throws IOException
Description copied from interface: HFileBlockEncodingContext
Do any action that needs to be performed after the encoding. Compression is also included if a non-null compression algorithm is used

Specified by:
postEncoding in interface HFileBlockEncodingContext
Throws:
IOException

compressAfterEncodingWithBlockType

public void compressAfterEncodingWithBlockType(byte[] uncompressedBytesWithHeader,
                                               BlockType blockType)
                                        throws IOException
Parameters:
uncompressedBytesWithHeader -
blockType -
Throws:
IOException

compressAfterEncoding

protected void compressAfterEncoding(byte[] uncompressedBytesWithHeader,
                                     BlockType blockType,
                                     byte[] headerBytes)
                              throws IOException
Parameters:
uncompressedBytesWithHeader -
blockType -
headerBytes -
Throws:
IOException

getOnDiskBytesWithHeader

public byte[] getOnDiskBytesWithHeader()
Specified by:
getOnDiskBytesWithHeader in interface HFileBlockEncodingContext
Returns:
encoded and compressed bytes with header which are ready to write out to disk

getUncompressedBytesWithHeader

public byte[] getUncompressedBytesWithHeader()
Specified by:
getUncompressedBytesWithHeader in interface HFileBlockEncodingContext
Returns:
encoded but not heavily compressed bytes with header which can be cached in block cache

getBlockType

public BlockType getBlockType()
Specified by:
getBlockType in interface HFileBlockEncodingContext
Returns:
the block type after encoding

close

public void close()
Releases the compressor this writer uses to compress blocks into the compressor pool.

Specified by:
close in interface HFileBlockEncodingContext

getOutputStreamForEncoder

public DataOutputStream getOutputStreamForEncoder()
Specified by:
getOutputStreamForEncoder in interface HFileBlockEncodingContext
Returns:
OutputStream to which encoded data is written

getDataBlockEncoding

public DataBlockEncoding getDataBlockEncoding()
Specified by:
getDataBlockEncoding in interface HFileBlockEncodingContext
Returns:
the DataBlockEncoding encoding used

getHFileContext

public HFileContext getHFileContext()
Specified by:
getHFileContext in interface HFileBlockEncodingContext
Returns:
HFile context information

getTagCompressionContext

public TagCompressionContext getTagCompressionContext()

setTagCompressionContext

public void setTagCompressionContext(TagCompressionContext tagCompressionContext)


Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.