mx.udlap.kjProtocol.packets
Class KString

java.lang.Object
  extended bymx.udlap.kjProtocol.packets.KString
Direct Known Subclasses:
KUUID

public class KString
extends java.lang.Object

Contains a byte array String with a 4 bytes length field.

Author:
Oscar Medina Duarte

Field Summary
 KInteger length
           
 byte[] value
           
 
Constructor Summary
protected KString()
           
  KString(byte[] value)
          Constructor for the KString object
  KString(java.lang.String value)
          Constructor for the KString object
  KString(java.lang.String value, java.lang.String charsetName)
          Constructor for the KString object
 
Method Summary
 byte[] getBytes()
          Gets the bytes attribute of the KString object
 KInteger getLength()
          Gets the lenght attribute of the KString object
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

length

public KInteger length

value

public byte[] value
Constructor Detail

KString

protected KString()

KString

public KString(java.lang.String value)
Constructor for the KString object

Parameters:
value - String contained in a String field

KString

public KString(java.lang.String value,
               java.lang.String charsetName)
        throws java.io.UnsupportedEncodingException
Constructor for the KString object

Parameters:
value - String contained in a String field
charsetName - Charset Name to use for converting String to bytes
Throws:
java.io.UnsupportedEncodingException - Description of the Exception

KString

public KString(byte[] value)
Constructor for the KString object

Parameters:
value - Byte array contained in a String field
Method Detail

getBytes

public byte[] getBytes()
Gets the bytes attribute of the KString object

With the form: <length><StringBytes>

Returns:
The bytes value

toString

public java.lang.String toString()

getLength

public KInteger getLength()
Gets the lenght attribute of the KString object

Returns:
Number of bytes, not including the 4 bytes length field