public class TLV extends Object
It is a tuple allowing typed opaque information to be passed through the OSCAR protocol. Typically, TLV's are intended for interpretation at the core layer. Since they are typed, new TLV elements can be added to the protocol without modifying the lower layers.
TLVType
Constructor and Description |
---|
TLV()
Creates a new (empty) TLV.
|
TLV(int type,
int length,
byte[] value)
Creates a new TLV.
|
Modifier and Type | Method and Description |
---|---|
int |
getLength()
Get the value of length.
|
int |
getType()
Get the value of type.
|
byte[] |
getValue()
Get the value of value.
|
byte |
getValueByte()
Get the value of this TLV as a byte.
|
int |
getValueInt()
Get the value of this TLV as an integer.
|
short |
getValueShort()
Get the value of this TLV as a short.
|
String |
getValueString()
Get the value of this TLV as a string.
|
String |
getValueString(String enc)
Get the value of this TLV as a string with the given encoding.
|
void |
setLength(int length)
Set the value of length.
|
void |
setType(int type)
Set the value of type.
|
void |
setValue(byte[] value)
Set the value of value.
|
void |
setValueByte(int value)
Set the value of this TLV as a byte
|
void |
setValueInt(int value)
Set the value of this TLV as an integer
|
void |
setValueShort(int value)
Set the value of this TLV as a short.
|
void |
setValueString(String value)
Set the value of this TLV as a string
|
String |
toString()
Return a string representation of this TLV.
|
public TLV()
public TLV(int type, int length, byte[] value) throws IOException
type
- the type of TLVlength
- the length of the TLVvalue
- the value of the TLVIOException
- if an error occurspublic int getType()
public void setType(int type)
type
- Value to assign to type.public int getLength()
public void setLength(int length)
length
- Value to assign to length.public byte[] getValue()
public void setValue(byte[] value)
value
- Value to assign to value.public String getValueString(String enc) throws UnsupportedEncodingException
enc
- the AOL encoding stringUnsupportedEncodingException
- if an error occurspublic String getValueString() throws UnsupportedEncodingException
UnsupportedEncodingException
- if an error occurspublic void setValueString(String value) throws IOException
value
- the string to assign to this TLVIOException
- if an error occurspublic byte getValueByte() throws IOException
IOException
- if an error occurspublic void setValueByte(int value) throws IOException
value
- the byte to assign to this TLVIOException
- if an error occurspublic short getValueShort() throws IOException
IOException
- if an error occurspublic void setValueShort(int value) throws IOException
value
- the short to assign to this TLVIOException
- if an error occurspublic int getValueInt() throws IOException
IOException
- if an error occurspublic void setValueInt(int value) throws IOException
value
- the integer to assign to this TLVIOException
- if an error occurs