|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Represents a "chain," or block, or sequence, of Tlv
s.
Method Summary | |
Tlv |
getFirstTlv(int type)
Returns the first TLV in this chain with the given type, or null of TLV of the given type is present. |
Tlv |
getLastTlv(int type)
Returns the last TLV in this chain with the given type, or null of TLV of the given type is present. |
java.lang.String |
getString(int type)
Returns the ASCII string contained in the last TLV in this chain with the given type, or null if no TLV with the given type
is present in this chain. |
java.lang.String |
getString(int type,
java.lang.String charset)
Returns the string contained in the last TLV in this chain with the given type, decoded with the given charset, or null
if no TLV with the given type is present in this chain. |
int |
getTlvCount()
Returns the number of TLV's in this chain. |
Tlv[] |
getTlvs()
Returns an array of all TLV's in this chain, in order. |
Tlv[] |
getTlvs(int type)
Returns an array containing all TLV's in this chain with the given TLV type, with original order preserved. |
int |
getTotalSize()
Returns the total size, in bytes, of this chain, as read from an incoming stream. |
long |
getUInt(int type)
Returns an unsigned four-byte integer read from the value of the last TLV of the given type in this chain, or -1 if
either no TLV of the given type is present in this chain or if the data
block for the TLV contains fewer than two bytes. |
int |
getUShort(int type)
Returns an unsigned two-byte integer read from the value of the last TLV of the given type in this chain, or -1 if
either no TLV of the given type is present in this chain or if the data
block for the TLV contains fewer than two bytes. |
boolean |
hasTlv(int type)
Returns true if this TLV chain contains any TLV's of the
given TLV type. |
java.util.Iterator |
iterator()
Returns an iterator over the TLV's in this TLV chain. |
Methods inherited from interface net.kano.joscar.Writable |
getWritableLength, write |
Method Detail |
public boolean hasTlv(int type)
true
if this TLV chain contains any TLV's of the
given TLV type.
type
- a TLV type
public Tlv[] getTlvs()
public java.util.Iterator iterator()
public int getTlvCount()
public Tlv getFirstTlv(int type)
null
of TLV of the given type is present.
type
- the type of TLV whose first match will be returned
null
if none was foundpublic Tlv getLastTlv(int type)
null
of TLV of the given type is present.
type
- the type of TLV whose last match will be returned
null
if none was foundpublic Tlv[] getTlvs(int type)
null
.
type
- the type of TLV whose matching TLV's will be returned
public java.lang.String getString(int type)
null
if no TLV with the given type
is present in this chain. Equivalent to chain.hasTlv(type) ?
chain.getLastTlv(type).getDataAsString() : null
.
type
- the type of TLV whose ASCII string value will be returned
getLastTlv(int)
,
Tlv.getDataAsString()
public java.lang.String getString(int type, java.lang.String charset)
null
if no TLV with the given type is present in this chain. Note that if the
given charset is not found in this JVM, a valid charset will be derived
(like converting "unicode-2.0" to "UTF-16BE") or "US-ASCII" will be used.
type
- the type of TLV whose string value will be returnedcharset
- the charset with which the string will be decoded, or
null
to decode as US-ASCII
getLastTlv(int)
public int getUShort(int type)
-1
if
either no TLV of the given type is present in this chain or if the data
block for the TLV contains fewer than two bytes.
type
- the type of the TLV whose value will be returned
-1
if none is presentgetLastTlv(int)
,
Tlv.getDataAsUShort()
public long getUInt(int type)
-1
if
either no TLV of the given type is present in this chain or if the data
block for the TLV contains fewer than two bytes.
type
- the type of the TLV whose value will be returned
-1
if none is presentgetLastTlv(int)
,
Tlv.getDataAsUInt()
public int getTotalSize()
-1
if this chain was not read from a stream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |