Class TLVList
java.lang.Object
org.jpos.tlv.TLVList
- All Implemented Interfaces:
Serializable, Loggeable
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(int tag, byte[] value) Append TLVMsg to the TLVList.Append TLVMsg to the TLVList.voidAppend TLVMsg to the TLV list.protected TLVMsgcreateTLVMsg(int tag, byte[] value) Create TLV message instance.voiddeleteByIndex(int index) delete the specified TLV from the list using a Zero based indexvoiddeleteByTag(int tag) Delete the specified TLV from the list by tag valuevoiddump(PrintStream p, String indent) elements()find(int tag) Searches the list for a specified tag and returns a TLV object.intfindIndex(int tag) Searches the list for a specified tag and returns a zero based index for that tag.Return the next TLVMsg of same TAG value.getString(int tag) searches the list for a specified tag and returns a hex StringgetTags()byte[]getValue(int tag) searches the list for a specified tag and returns it rawprotected intgetValueLength(ByteBuffer buffer) Read length bytes and return the int valuebooleanhasTag(int tag) Indicates if TLV measege with passedtagis on list.index(int index) Returns aTLVMsginstance stored within theTLVListat the givenindex.byte[]pack()Pack the TLV message (BER-TLV Encoding).voidunpack(byte[] buf) Unpack a message.voidunpack(byte[] buf, int offset) Unpack a message with a starting offset.
-
Constructor Details
-
TLVList
public TLVList()Creates instance of TLV engine.It is a shorter form of:
TLVListBuilder.createInstance().build();
-
-
Method Details
-
unpack
Unpack a message.- Parameters:
buf- raw message- Throws:
IllegalArgumentException
-
getTags
-
elements
- Returns:
- an enumeration of the List of tags.
-
unpack
public void unpack(byte[] buf, int offset) throws IllegalArgumentException, IndexOutOfBoundsException Unpack a message with a starting offset.- Parameters:
buf- raw messageoffset- the offset- Throws:
IndexOutOfBoundsException- ifoffsetexceeds {code buf.length}IllegalArgumentException
-
append
Append TLVMsg to the TLV list.- Parameters:
tlv- the TLV message- Throws:
NullPointerException- iftlvisnull
-
append
Append TLVMsg to the TLVList.- Parameters:
tag- tag idvalue- tag value- Returns:
- the TLV list instance
- Throws:
IllegalArgumentException- when contains tag with illegal id
-
append
Append TLVMsg to the TLVList.- Parameters:
tag- idvalue- in hexadecimal character representation- Returns:
- the TLV list instance
- Throws:
IllegalArgumentException- when contains tag with illegal id
-
deleteByIndex
delete the specified TLV from the list using a Zero based index- Parameters:
index- number
-
deleteByTag
Delete the specified TLV from the list by tag value- Parameters:
tag- id
-
find
-
findIndex
Searches the list for a specified tag and returns a zero based index for that tag.- Parameters:
tag- tag identifier- Returns:
- index for a given
tag
-
findNextTLV
Return the next TLVMsg of same TAG value.- Returns:
- TLV message or
nullif not found. - Throws:
IllegalStateException- when the search has not been initiated
-
index
Returns aTLVMsginstance stored within theTLVListat the givenindex.- Parameters:
index- zero based index of TLV message- Returns:
- TLV message instance
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index >= size())
-
pack
-
createTLVMsg
Create TLV message instance.- Parameters:
tag- tag identifiervalue- the value of tag- Returns:
- TLV message instance
- Throws:
IllegalArgumentException- when contains tag with illegal id- API Note:
- The protected scope is intended to not promote the use of TLVMsg outside.
-
getValueLength
Read length bytes and return the int value- Parameters:
buffer- buffer- Returns:
- value length
- Throws:
IllegalArgumentException
-
getString
-
getValue
searches the list for a specified tag and returns it raw- Parameters:
tag- id- Returns:
- byte[]
-
hasTag
Indicates if TLV measege with passedtagis on list.- Parameters:
tag- tag identifier- Returns:
trueif tag contains on list,falseotherwise
-
dump
-