Copyright © Rasmus Sten and contributors, 1997-2004

nu.dll.lyskom
Class KomToken

java.lang.Object
  |
  +--nu.dll.lyskom.KomToken
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Bitstring, Hollerith, KomTokenArray

public class KomToken
extends java.lang.Object
implements java.io.Serializable

A KomToken represents an object to be sent to or has been received from the server. It is generally a serie of bytes.

See Also:
Serialized Form

Field Summary
static int ARRAY
          An array of KomToken objects
static int COMPL
          A "complex" LysKOM token.
static int HOLLERITH
          A Hollerith
static int PRIMITIVE
          A "primitive" LysKOM token, such as INT32
 
Constructor Summary
KomToken()
          Creates an empty KomToken object.
KomToken(byte[] b)
          Constructs a simple KomToken object containing the supplied bytes.
KomToken(int i)
          Constructs a simple KomToken object representing the supplied integer value.
KomToken(java.lang.String s)
          Converts the supplied string into bytes according to the default encoding, using the result as the contents for this KomToken
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if the supplied object is of type KomToken, and it's contents are equal to this, or if it is a String which, converted to the default charset, equals this object's contents, or if it is an Integer, which, when converted to a Protocol A representation of its value, is equal to this object's contents.
 byte[] getContents()
          Returns the contents of this KomToken
 int getType()
          Returns the type of this KomToken
 int intValue()
          Attempts to parse the contents of this KomToken into an integer value using a radix of 10.
 boolean isEol()
          Returns true if this KomToken is the last token in a command received from the server.
 void setContents(byte[] c)
          Sets the contents of this KomToken
 int toInt()
          Deprecated. use intValue() instead
 int toInteger()
          Deprecated. use intValue() to get an int, this method will be changed to return Integer
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PRIMITIVE

public static final int PRIMITIVE
A "primitive" LysKOM token, such as INT32

See Also:
Constant Field Values

COMPL

public static final int COMPL
A "complex" LysKOM token.

See Also:
Constant Field Values

ARRAY

public static final int ARRAY
An array of KomToken objects

See Also:
Constant Field Values

HOLLERITH

public static final int HOLLERITH
A Hollerith

See Also:
Constant Field Values
Constructor Detail

KomToken

public KomToken()
Creates an empty KomToken object.


KomToken

public KomToken(int i)
Constructs a simple KomToken object representing the supplied integer value.


KomToken

public KomToken(byte[] b)
Constructs a simple KomToken object containing the supplied bytes.


KomToken

public KomToken(java.lang.String s)
Converts the supplied string into bytes according to the default encoding, using the result as the contents for this KomToken

Method Detail

equals

public boolean equals(java.lang.Object o)
Returns true if the supplied object is of type KomToken, and it's contents are equal to this, or if it is a String which, converted to the default charset, equals this object's contents, or if it is an Integer, which, when converted to a Protocol A representation of its value, is equal to this object's contents.

Overrides:
equals in class java.lang.Object

isEol

public boolean isEol()
Returns true if this KomToken is the last token in a command received from the server.


toInteger

public int toInteger()
Deprecated. use intValue() to get an int, this method will be changed to return Integer


intValue

public int intValue()
Attempts to parse the contents of this KomToken into an integer value using a radix of 10.


toInt

public int toInt()
Deprecated. use intValue() instead


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getContents

public byte[] getContents()
Returns the contents of this KomToken


setContents

public void setContents(byte[] c)
Sets the contents of this KomToken


getType

public int getType()
Returns the type of this KomToken


Copyright © Rasmus Sten and contributors, 1997-2004