public class Tlv extends Object
| Constructor and Description |
|---|
Tlv(short tag,
byte[] value) |
Tlv(short tag,
byte[] value,
String tagName)
The tagName is only for logging/debugging by showing up in the toString() method.
|
| Modifier and Type | Method and Description |
|---|---|
int |
calculateByteSize()
Returns the size of this TLV in bytes.
|
short |
getLength() |
short |
getTag() |
String |
getTagName() |
int |
getUnsignedLength()
Gets an "unsigned" version of this TLV's length of its value.
|
byte[] |
getValue() |
byte |
getValueAsByte()
Attempts to get the underlying value as a byte.
|
int |
getValueAsInt()
Attempts to get the underlying value as an int.
|
long |
getValueAsLong()
Attempts to get the underlying value as a long.
|
short |
getValueAsShort()
Attempts to get the underlying value as a short.
|
String |
getValueAsString() |
String |
getValueAsString(String charsetName) |
short |
getValueAsUnsignedByte()
Attempts to get the underlying value as an unsigned byte.
|
long |
getValueAsUnsignedInt()
Attempts to get the underlying value as an unsigned int.
|
int |
getValueAsUnsignedShort()
Attempts to get the underlying value as an unsigned short.
|
void |
setTagName(String value) |
String |
toString() |
public Tlv(short tag, byte[] value)
public Tlv(short tag, byte[] value, String tagName)
tag - value - tagName - public String getTagName()
public void setTagName(String value)
public short getTag()
public int getUnsignedLength()
public short getLength()
public byte[] getValue()
public int calculateByteSize()
public String getValueAsString() throws TlvConvertException
TlvConvertExceptionpublic String getValueAsString(String charsetName) throws TlvConvertException
TlvConvertExceptionpublic byte getValueAsByte()
throws TlvConvertException
TlvConvertException - Thrown if the underlying byte array cannot
be converted to a byte.public short getValueAsUnsignedByte()
throws TlvConvertException
TlvConvertException - Thrown if the underlying byte array cannot
be converted to an unsigned byte.public short getValueAsShort()
throws TlvConvertException
TlvConvertException - Thrown if the underlying byte array cannot
be converted to a short.public int getValueAsUnsignedShort()
throws TlvConvertException
TlvConvertException - Thrown if the underlying byte array cannot
be converted to an unsigned short.public int getValueAsInt()
throws TlvConvertException
TlvConvertException - Thrown if the underlying byte array cannot
be converted to an int.public long getValueAsUnsignedInt()
throws TlvConvertException
TlvConvertException - Thrown if the underlying byte array cannot
be converted to an unsigned int.public long getValueAsLong()
throws TlvConvertException
TlvConvertException - Thrown if the underlying byte array cannot
be converted to a long.Copyright © 2009-2014 Cloudhopper by Twitter. All Rights Reserved.