@InterfaceAudience.Private @InterfaceStability.Evolving public class Tag extends Object
Modifier and Type | Field and Description |
---|---|
private byte[] |
bytes |
static int |
INFRASTRUCTURE_SIZE |
private int |
length |
static int |
MAX_TAG_LENGTH |
private int |
offset |
static int |
TAG_LENGTH_SIZE |
private byte |
type |
static int |
TYPE_LENGTH_SIZE |
Constructor and Description |
---|
Tag(byte[] bytes,
int offset)
Creates a Tag from the specified byte array and offset.
|
Tag(byte[] bytes,
int offset,
int length)
Creates a Tag from the specified byte array, starting at offset, and for length
length . |
Tag(byte tagType,
byte[] tag) |
Tag(byte tagType,
String tag) |
Modifier and Type | Method and Description |
---|---|
static List<Tag> |
asList(byte[] b,
int offset,
int length)
Creates the list of tags from the byte array b.
|
static List<Tag> |
carryForwardTags(Cell cell) |
static List<Tag> |
carryForwardTags(List<Tag> tagsOrNull,
Cell cell) |
static byte[] |
fromList(List<Tag> tags)
Write a list of tags into a byte array
|
byte[] |
getBuffer() |
(package private) int |
getLength()
Returns the total length of the entire tag entity
|
private static int |
getLength(byte[] bytes,
int offset) |
(package private) int |
getOffset()
Returns the offset of the entire tag entity
|
static Tag |
getTag(byte[] b,
int offset,
int length,
byte type)
Retrieve the first tag from the tags byte array matching the passed in tag type
|
int |
getTagLength() |
int |
getTagOffset() |
byte |
getType() |
byte[] |
getValue()
Returns tag value in a new byte array.
|
public static final int TYPE_LENGTH_SIZE
public static final int TAG_LENGTH_SIZE
public static final int INFRASTRUCTURE_SIZE
public static final int MAX_TAG_LENGTH
private final byte type
private final byte[] bytes
private int offset
private int length
public Tag(byte tagType, String tag)
public Tag(byte tagType, byte[] tag)
tagType
- tag
- public Tag(byte[] bytes, int offset)
bytes
content starting at offset
is formatted as
a Tag blob.
The bytes to include the tag type, tag length and actual tag bytes.bytes
- byte arrayoffset
- offset to start of Tagpublic Tag(byte[] bytes, int offset, int length)
length
. Presumes bytes
content starting at offset
is
formatted as a Tag blob.bytes
- byte arrayoffset
- offset to start of the Taglength
- length of the Tagprivate static int getLength(byte[] bytes, int offset)
public byte[] getBuffer()
public byte getType()
public int getTagLength()
public int getTagOffset()
public byte[] getValue()
getBuffer()
with appropriate getTagOffset()
and getTagLength()
instead to save on allocations.public static List<Tag> asList(byte[] b, int offset, int length)
b
- offset
- length
- public static byte[] fromList(List<Tag> tags)
tags
- public static Tag getTag(byte[] b, int offset, int length, byte type)
b
- offset
- length
- type
- int getLength()
int getOffset()
public static List<Tag> carryForwardTags(Cell cell)
cell
else null.Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.