@InterfaceAudience.Private public final class TagUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<Tag> |
asList(byte[] b,
int offset,
int length)
Creates list of tags from given byte array, expected that it is in the expected tag format.
|
static List<Tag> |
asList(ByteBuffer b,
int offset,
int length)
Creates list of tags from given ByteBuffer, expected that it is in the expected tag format.
|
static List<Tag> |
carryForwardTags(Cell cell) |
static List<Tag> |
carryForwardTags(List<Tag> tagsOrNull,
Cell cell)
Add to
tagsOrNull any Tags cell is carrying or null if none. |
static List<Tag> |
carryForwardTTLTag(List<Tag> tagsOrNull,
long ttl) |
static void |
checkForTagsLength(int tagsLength)
Check the length of tags.
|
static byte[] |
cloneValue(Tag tag)
Returns tag value in a new byte array.
|
static byte[] |
concatTags(byte[] tags,
Cell cell) |
static void |
copyValueTo(Tag tag,
byte[] out,
int offset)
Copies the tag's value bytes to the given byte array
|
static byte[] |
fromList(List<Tag> tags)
Write a list of tags into a byte array
|
static byte |
getValueAsByte(Tag tag)
Converts the value bytes of the given tag into a byte value
|
static long |
getValueAsLong(Tag tag)
Converts the value bytes of the given tag into a long value
|
static String |
getValueAsString(Tag tag)
Converts the value bytes of the given tag into a String value
|
static boolean |
matchingValue(Tag t1,
Tag t2)
Matches the value part of given tags
|
static Pair<Integer,Integer> |
readVIntValuePart(Tag tag,
int offset)
Reads an int value stored as a VInt at tag's given offset.
|
public static byte[] cloneValue(Tag tag)
Tag.getValueArray() with appropriate Tag.getValueOffset()
and Tag.getValueLength() instead to save on allocations.tag - The Tag whose value to be returnedpublic static List<Tag> asList(byte[] b, int offset, int length)
b - The byte arrayoffset - The offset in array where tag bytes beginlength - Total length of all tags bytespublic static List<Tag> asList(ByteBuffer b, int offset, int length)
b - The ByteBufferoffset - The offset in ByteBuffer where tag bytes beginlength - Total length of all tags bytespublic static byte[] fromList(List<Tag> tags)
tags - The list of tagspublic static long getValueAsLong(Tag tag)
tag - The Tagpublic static byte getValueAsByte(Tag tag)
tag - The Tagpublic static String getValueAsString(Tag tag)
tag - The Tagpublic static boolean matchingValue(Tag t1, Tag t2)
t1 - Tag to match the valuet2 - Tag to match the valuepublic static void copyValueTo(Tag tag, byte[] out, int offset)
tag - The Tagout - The byte array where to copy the Tag value.offset - The offset within 'out' array where to copy the Tag value.public static Pair<Integer,Integer> readVIntValuePart(Tag tag, int offset) throws IOException
tag - The Tagoffset - The offset where VInt bytes beginIOException - When varint is malformed and not able to be read correctlypublic static List<Tag> carryForwardTags(Cell cell)
cell else null.public static List<Tag> carryForwardTags(List<Tag> tagsOrNull, Cell cell)
tagsOrNull any Tags cell is carrying or null if none.public static byte[] concatTags(byte[] tags,
Cell cell)
public static List<Tag> carryForwardTTLTag(List<Tag> tagsOrNull, long ttl)
public static void checkForTagsLength(int tagsLength)
tagsLength - IllegalArgumentException - if tagslength is invalidCopyright © 2007–2017 The Apache Software Foundation. All rights reserved.