Package org.apache.hadoop.hbase
Interface Tag
- All Known Implementing Classes:
ArrayBackedTag,ByteBufferTag
Tags are part of cells and helps to add metadata about them. Metadata could be ACLs, visibility
labels, etc.
Each Tag is having a type (one byte) and value part. The max value length for a Tag is 65533.
See TagType for reserved tag types.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteCustom tags if created are suggested to be above this range.static final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]cloneValue(Tag tag) Returns tag value in a new byte array.static voidcopyValueTo(Tag tag, byte[] out, int offset) Copies the tag's value bytes to the given byte arraybytegetType()Returns the tag typebyte[]Return an array containing the value bytes ifhasArray()returns true.static bytegetValueAsByte(Tag tag) Converts the value bytes of the given tag into a byte valuestatic longgetValueAsLong(Tag tag) Converts the value bytes of the given tag into a long valuestatic StringgetValueAsString(Tag tag) Converts the value bytes of the given tag into a String valueReturns TheByteBuffercontaining the value bytes.intReturns Length of tag value within the backed bufferintReturns Offset of tag value within the backed bufferbooleanhasArray()Return true if the tag is backed by a byte arraystatic booleanmatchingValue(Tag t1, Tag t2) Matches the value part of given tags
-
Field Details
-
TYPE_LENGTH_SIZE
- See Also:
-
TAG_LENGTH_SIZE
- See Also:
-
INFRASTRUCTURE_SIZE
- See Also:
-
MAX_TAG_LENGTH
- See Also:
-
CUSTOM_TAG_TYPE_RANGE
Custom tags if created are suggested to be above this range. So that it does not overlap with internal tag types- See Also:
-
-
Method Details
-
getType
byte getType()Returns the tag type -
getValueOffset
int getValueOffset()Returns Offset of tag value within the backed buffer -
getValueLength
int getValueLength()Returns Length of tag value within the backed buffer -
hasArray
boolean hasArray()Return true if the tag is backed by a byte array -
getValueArray
byte[] getValueArray()Return an array containing the value bytes ifhasArray()returns true.Use
getValueByteBuffer()otherwise. -
getValueByteBuffer
Returns TheByteBuffercontaining the value bytes. -
cloneValue
Returns tag value in a new byte array. Primarily for use client-side. If server-side, usegetValueArray()with appropriategetValueOffset()andgetValueLength()instead to save on allocations.- Parameters:
tag- The Tag whose value to be returned- Returns:
- tag value in a new byte array.
-
getValueAsString
Converts the value bytes of the given tag into a String value- Parameters:
tag- The Tag- Returns:
- value as String
-
matchingValue
Matches the value part of given tags- Parameters:
t1- Tag to match the valuet2- Tag to match the value- Returns:
- True if values of both tags are same.
-
copyValueTo
Copies the tag's value bytes to the given byte array- Parameters:
tag- The Tagout- The byte array where to copy the Tag value.offset- The offset within 'out' array where to copy the Tag value.
-
getValueAsLong
Converts the value bytes of the given tag into a long value- Parameters:
tag- The Tag- Returns:
- value as long
-
getValueAsByte
Converts the value bytes of the given tag into a byte value- Parameters:
tag- The Tag- Returns:
- value as byte
-