public class CharTagMap extends java.util.HashMap<java.lang.String,CharTag>
The CharTagMap features:
pack and unpack) on character sequences
| Constructor and Description |
|---|
CharTagMap() |
| Modifier and Type | Method and Description |
|---|---|
CharTagMap |
addTag(java.lang.String tagId,
java.lang.String value)
Adds a new tag to map.
|
CharTag |
createTLV(java.lang.String tagId,
java.lang.String value)
Create new TLV tag.
|
static CharTagMap |
getInstance()
Creates new empty instance of text TLV tag map.
|
java.lang.String |
getTagValue(java.lang.String tagId)
Gets the value of the tag with given tagId from map.
|
boolean |
hasTag(java.lang.String tagId)
Chceck if the tag with given tag identifier is in this tag map.
|
java.lang.String |
pack()
Pack TLV Tags.
|
protected void |
setLengthSize(int size)
Sets size of length element.
|
protected void |
setTagSize(int size)
Sets size of tag element.
|
void |
unpack(java.lang.CharSequence data)
Unpack string to TLV tag map.
|
protected void |
validateTag(java.lang.String tagId) |
protected void |
withTagLengthSwap(boolean swap)
Sets size of length element.
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic static CharTagMap getInstance()
This method creates default TLV tag map which works on TLV data with followng parameters:
CharTagMapprotected void setTagSize(int size)
throws java.lang.IllegalArgumentException
size - size of tag elamentjava.lang.IllegalArgumentExceptionprotected void setLengthSize(int size)
throws java.lang.IllegalArgumentException
size - size of length elamentjava.lang.IllegalArgumentExceptionprotected void withTagLengthSwap(boolean swap)
swap - indicates if tag element will be swapped with length elementpublic void unpack(java.lang.CharSequence data)
throws java.lang.IllegalArgumentException
data - sequence of characters encoded as TLVjava.lang.IllegalArgumentException - if null or parsing error occurspublic java.lang.String pack()
public CharTagMap addTag(java.lang.String tagId, java.lang.String value) throws java.lang.IllegalArgumentException
tagId - tag identifier, not nullvalue - tag valuejava.lang.IllegalArgumentException - if tagId is null or has
invalid length.public CharTag createTLV(java.lang.String tagId, java.lang.String value) throws java.lang.IllegalArgumentException
tagId - tag identifier, not nullvalue - tag valuejava.lang.IllegalArgumentException - if tagId is null or has
invalid length.protected void validateTag(java.lang.String tagId)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic java.lang.String getTagValue(java.lang.String tagId)
tagId - tag identifierpublic boolean hasTag(java.lang.String tagId)
tagId - tag identifiertrue if this map contains the tag, otherwise return false