public abstract class HFileBlock extends Object
HFileBlockType.| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
byteBuff |
protected int |
bytesPerChecksum |
protected byte[] |
compressedByteBuff |
protected HFileContext |
context |
static int |
HFILEBLOCK_HEADER_SIZE |
static int |
HFILEBLOCK_HEADER_SIZE_NO_CHECKSUM |
protected int |
onDiskSizeWithoutHeader |
protected int |
sizeCheckSum |
protected int |
startOffsetInBuff |
protected int |
startOffsetInCompressedBuff |
protected int |
uncompressedEndOffset |
protected int |
uncompressedSizeWithoutHeader |
| Modifier | Constructor and Description |
|---|---|
protected |
HFileBlock(HFileContext context,
HFileBlockType blockType,
byte[] byteBuff,
int startOffsetInBuff) |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
allocateBufferForUnpacking()
Allocates new byte buffer for the uncompressed bytes.
|
HFileBlockType |
getBlockType() |
byte[] |
getByteBuff() |
int |
getOnDiskSizeWithHeader() |
static HFileBlock |
parse(HFileContext context,
byte[] byteBuff,
int startOffsetInBuff)
Parses the HFile block header and returns the
HFileBlock instance based on the input. |
void |
unpack()
Decodes and decompresses the block content if the block content is compressed.
|
public static final int HFILEBLOCK_HEADER_SIZE_NO_CHECKSUM
public static final int HFILEBLOCK_HEADER_SIZE
protected final HFileContext context
protected final byte[] byteBuff
protected final int startOffsetInBuff
protected final int sizeCheckSum
protected final int uncompressedEndOffset
protected final int onDiskSizeWithoutHeader
protected final int uncompressedSizeWithoutHeader
protected final int bytesPerChecksum
protected byte[] compressedByteBuff
protected int startOffsetInCompressedBuff
protected HFileBlock(HFileContext context, HFileBlockType blockType, byte[] byteBuff, int startOffsetInBuff)
public static HFileBlock parse(HFileContext context, byte[] byteBuff, int startOffsetInBuff) throws IOException
HFileBlock instance based on the input.context - HFile context.byteBuff - input data.startOffsetInBuff - offset to start parsing.HFileBlock instance based on the input.IOException - if the block cannot be parsed.public HFileBlockType getBlockType()
public byte[] getByteBuff()
public int getOnDiskSizeWithHeader()
public void unpack()
throws IOException
This must be called for an encoded and compressed block before any reads.
IOException - upon decoding and decompression error.protected byte[] allocateBufferForUnpacking()
Copyright © 2024 The Apache Software Foundation. All rights reserved.