Class EncodedDataBlock
java.lang.Object
org.apache.hadoop.hbase.io.encoding.EncodedDataBlock
Encapsulates a data block compressed using a particular encoding algorithm. Useful for testing
and benchmarking. This is used only in testing.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[]private final org.apache.hadoop.conf.Configurationprivate DataBlockEncoderprivate final DataBlockEncodingprivate final HFileBlockEncodingContextprivate HFileContextprivate ByteBufferprivate byte[] -
Constructor Summary
ConstructorsConstructorDescriptionEncodedDataBlock(org.apache.hadoop.conf.Configuration conf, DataBlockEncoder dataBlockEncoder, DataBlockEncoding encoding, byte[] rawKVs, HFileContext meta) Create a buffer which will be encoded using dataBlockEncoder. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Do the encoding, but do not cache the encoded data.static intgetCompressedSize(Compression.Algorithm algo, org.apache.hadoop.io.compress.Compressor compressor, byte[] inputBuffer, int offset, int length) Find the size of compressed data assuming that buffer will be compressed using given algorithm.intgetEncodedCompressedSize(Compression.Algorithm comprAlgo, org.apache.hadoop.io.compress.Compressor compressor) Estimate size after second stage of compression (e.g.private byte[]Returns encoded data with headergetIterator(int headerSize) Provides access to compressed value.intgetSize()Find the size of minimal buffer that could store compressed data.private ByteBuffertoString()
-
Field Details
-
rawKVs
-
rawBuffer
-
dataBlockEncoder
-
cachedEncodedData
-
encodingCtx
-
meta
-
encoding
-
conf
-
isTagsLenZero
-
-
Constructor Details
-
EncodedDataBlock
public EncodedDataBlock(org.apache.hadoop.conf.Configuration conf, DataBlockEncoder dataBlockEncoder, DataBlockEncoding encoding, byte[] rawKVs, HFileContext meta) Create a buffer which will be encoded using dataBlockEncoder.- Parameters:
conf- store configurationdataBlockEncoder- Algorithm used for compression.encoding- encoding type usedrawKVs- raw KVsmeta- hfile context
-
-
Method Details
-
getIterator
Provides access to compressed value.- Parameters:
headerSize- header size of the block.- Returns:
- Forwards sequential iterator.
-
getSize
Find the size of minimal buffer that could store compressed data.- Returns:
- Size in bytes of compressed data.
-
getCompressedSize
public static int getCompressedSize(Compression.Algorithm algo, org.apache.hadoop.io.compress.Compressor compressor, byte[] inputBuffer, int offset, int length) throws IOException Find the size of compressed data assuming that buffer will be compressed using given algorithm.- Parameters:
algo- compression algorithmcompressor- compressor already requested from codecinputBuffer- Array to be compressed.offset- Offset to beginning of the data.length- Length to be compressed.- Returns:
- Size of compressed data in bytes.
- Throws:
IOException
-
getEncodedCompressedSize
public int getEncodedCompressedSize(Compression.Algorithm comprAlgo, org.apache.hadoop.io.compress.Compressor compressor) throws IOException Estimate size after second stage of compression (e.g. LZO).- Parameters:
comprAlgo- compression algorithm to be used for compressioncompressor- compressor corresponding to the given compression algorithm- Returns:
- Size after second stage of compression.
- Throws:
IOException
-
getEncodedData
Returns encoded data with header -
getUncompressedBuffer
-
encodeData
Do the encoding, but do not cache the encoded data.- Returns:
- encoded data block with header and checksum
-
toString
-