Package org.apache.hadoop.hbase
Class ArrayBackedTag
java.lang.Object
org.apache.hadoop.hbase.ArrayBackedTag
- All Implemented Interfaces:
Tag
This is a
Tag implementation in which value is backed by an on heap byte array.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private intprivate intprivate final byteFields inherited from interface org.apache.hadoop.hbase.Tag
CUSTOM_TAG_TYPE_RANGE, INFRASTRUCTURE_SIZE, MAX_TAG_LENGTH, TAG_LENGTH_SIZE, TYPE_LENGTH_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionArrayBackedTag(byte[] bytes, int offset) Creates a Tag from the specified byte array and offset.ArrayBackedTag(byte[] bytes, int offset, int length) Creates a Tag from the specified byte array, starting at offset, and for lengthlength.ArrayBackedTag(byte tagType, byte[] tag) Format for a tag :<length of tag - 2 bytes><type code - 1 byte><tag>tag length is serialized using 2 bytes only but as this will be unsigned, we can have max tag length of (Short.MAX_SIZE * 2) +1.ArrayBackedTag(byte tagType, String tag) The special tag will write the length of each tag and that will be followed by the type and then the actual tag. -
Method Summary
Modifier and TypeMethodDescriptionprivate static intgetLength(byte[] bytes, int offset) bytegetType()Returns the tag typebyte[]Returns The byte array backing this Tag.Returns TheByteBuffercontaining the value bytes.intReturns Length of actual tag bytes within the backed bufferintReturns Offset of actual tag bytes within the backed bufferbooleanhasArray()Return true if the tag is backed by a byte arraytoString()
-
Field Details
-
type
-
bytes
-
offset
-
length
-
-
Constructor Details
-
ArrayBackedTag
The special tag will write the length of each tag and that will be followed by the type and then the actual tag. So every time the length part is parsed we need to add + 1 byte to it to get the type and then get the actual tag. -
ArrayBackedTag
Format for a tag :<length of tag - 2 bytes><type code - 1 byte><tag>tag length is serialized using 2 bytes only but as this will be unsigned, we can have max tag length of (Short.MAX_SIZE * 2) +1. It includes 1 byte type length and actual tag bytes length. -
ArrayBackedTag
Creates a Tag from the specified byte array and offset. Presumesbytescontent starting atoffsetis formatted as a Tag blob. The bytes to include the tag type, tag length and actual tag bytes.- Parameters:
offset- offset to start of Tag
-
ArrayBackedTag
Creates a Tag from the specified byte array, starting at offset, and for lengthlength. Presumesbytescontent starting atoffsetis formatted as a Tag blob.
-
-
Method Details
-
getLength
-
getValueArray
Returns The byte array backing this Tag.- Specified by:
getValueArrayin interfaceTag
-
getType
Returns the tag type -
getValueLength
Returns Length of actual tag bytes within the backed buffer- Specified by:
getValueLengthin interfaceTag
-
getValueOffset
Returns Offset of actual tag bytes within the backed buffer- Specified by:
getValueOffsetin interfaceTag
-
hasArray
Description copied from interface:TagReturn true if the tag is backed by a byte array -
getValueByteBuffer
Description copied from interface:TagReturns TheByteBuffercontaining the value bytes.- Specified by:
getValueByteBufferin interfaceTag
-
toString
-