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
Modifier and TypeFieldDescriptionprivate final byte[]
private int
private int
private final byte
Fields 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
ConstructorDescriptionArrayBackedTag
(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 int
getLength
(byte[] bytes, int offset) byte
getType()
Returns the tag typebyte[]
Returns The byte array backing this Tag.Returns TheByteBuffer
containing the value bytes.int
Returns Length of actual tag bytes within the backed bufferint
Returns Offset of actual tag bytes within the backed bufferboolean
hasArray()
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. Presumesbytes
content starting atoffset
is 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
. Presumesbytes
content starting atoffset
is formatted as a Tag blob.
-
-
Method Details
-
getLength
-
getValueArray
Returns The byte array backing this Tag.- Specified by:
getValueArray
in interfaceTag
-
getType
Returns the tag type -
getValueLength
Returns Length of actual tag bytes within the backed buffer- Specified by:
getValueLength
in interfaceTag
-
getValueOffset
Returns Offset of actual tag bytes within the backed buffer- Specified by:
getValueOffset
in interfaceTag
-
hasArray
Description copied from interface:Tag
Return true if the tag is backed by a byte array -
getValueByteBuffer
Description copied from interface:Tag
Returns TheByteBuffer
containing the value bytes.- Specified by:
getValueByteBuffer
in interfaceTag
-
toString
-