public class TLVList extends java.lang.Object implements java.io.Serializable, Loggeable
| Modifier and Type | Class and Description |
|---|---|
static class |
TLVList.TLVListBuilder |
| Constructor and Description |
|---|
TLVList()
Creates instance of TLV engine.
|
| Modifier and Type | Method and Description |
|---|---|
TLVList |
append(int tag,
byte[] value)
Append TLVMsg to the TLVList.
|
TLVList |
append(int tag,
java.lang.String value)
Append TLVMsg to the TLVList.
|
void |
append(TLVMsg tlv)
Append TLVMsg to the TLV list.
|
protected TLVMsg |
createTLVMsg(int tag,
byte[] value)
Create TLV message instance.
|
void |
deleteByIndex(int index)
delete the specified TLV from the list using a Zero based index
|
void |
deleteByTag(int tag)
Delete the specified TLV from the list by tag value
|
void |
dump(java.io.PrintStream p,
java.lang.String indent) |
java.util.Enumeration<TLVMsg> |
elements() |
TLVMsg |
find(int tag)
Searches the list for a specified tag and returns a TLV object.
|
int |
findIndex(int tag)
Searches the list for a specified tag and returns a zero based index for
that tag.
|
TLVMsg |
findNextTLV()
Return the next TLVMsg of same TAG value.
|
java.lang.String |
getString(int tag)
searches the list for a specified tag and returns a hex String
|
java.util.List<TLVMsg> |
getTags() |
byte[] |
getValue(int tag)
searches the list for a specified tag and returns it raw
|
protected int |
getValueLength(java.nio.ByteBuffer buffer)
Read length bytes and return the int value
|
boolean |
hasTag(int tag)
Indicates if TLV measege with passed
tag is on list. |
TLVMsg |
index(int index)
Returns a
TLVMsg instance stored within the TLVList at
the given index. |
byte[] |
pack()
Pack the TLV message (BER-TLV Encoding).
|
void |
unpack(byte[] buf)
Unpack a message.
|
void |
unpack(byte[] buf,
int offset)
Unpack a message with a starting offset.
|
public TLVList()
It is a shorter form of:
TLVListBuilder.createInstance().build();
public void unpack(byte[] buf)
throws java.lang.IllegalArgumentException
buf - raw messagejava.lang.IllegalArgumentExceptionpublic java.util.List<TLVMsg> getTags()
public java.util.Enumeration<TLVMsg> elements()
public void unpack(byte[] buf,
int offset)
throws java.lang.IllegalArgumentException,
java.lang.IndexOutOfBoundsException
buf - raw messageoffset - the offsetjava.lang.IndexOutOfBoundsException - if offset exceeds {code buf.length}java.lang.IllegalArgumentExceptionpublic void append(TLVMsg tlv) throws java.lang.NullPointerException
tlv - the TLV messagejava.lang.NullPointerException - if tlv is nullpublic TLVList append(int tag, byte[] value) throws java.lang.IllegalArgumentException
tag - tag idvalue - tag valuejava.lang.IllegalArgumentException - when contains tag with illegal idpublic TLVList append(int tag, java.lang.String value) throws java.lang.IllegalArgumentException
tag - idvalue - in hexadecimal character representationjava.lang.IllegalArgumentException - when contains tag with illegal idpublic void deleteByIndex(int index)
index - numberpublic void deleteByTag(int tag)
tag - idpublic TLVMsg find(int tag)
tag - idpublic int findIndex(int tag)
tag - tag identifiertagpublic TLVMsg findNextTLV() throws java.lang.IllegalStateException
null if not found.java.lang.IllegalStateException - when the search has not been initiatedpublic TLVMsg index(int index) throws java.lang.IndexOutOfBoundsException
TLVMsg instance stored within the TLVList at
the given index.index - zero based index of TLV messagejava.lang.IndexOutOfBoundsException - if the index is out of range
(index < 0 || index >= size())public byte[] pack()
protected TLVMsg createTLVMsg(int tag, byte[] value) throws java.lang.IllegalArgumentException
tag - tag identifiervalue - the value of tagjava.lang.IllegalArgumentException - when contains tag with illegal idprotected int getValueLength(java.nio.ByteBuffer buffer)
throws java.lang.IllegalArgumentException
buffer - bufferjava.lang.IllegalArgumentExceptionpublic java.lang.String getString(int tag)
tag - idpublic byte[] getValue(int tag)
tag - idpublic boolean hasTag(int tag)
tag is on list.tag - tag identifiertrue if tag contains on list, false otherwise