org.ka2ddo.ax25
Class XIDParameter

java.lang.Object
  extended by org.ka2ddo.ax25.XIDParameter

public class XIDParameter
extends java.lang.Object

This class encapsulates one XID parameter. The caller is responsible for putting the XIDParameter object into an appropriately typed XIDGroup object.


Field Summary
static byte[] EMPTY_VALUE
           
 byte paramIdentifier
           
 byte[] paramValue
           
 
Constructor Summary
XIDParameter(byte paramIdentifier)
          Create an XIDParameter with an empty value (presence implies the value).
XIDParameter(byte paramIdentifier, byte val)
          Create an XIDParameter with a 1-byte value.
XIDParameter(byte paramIdentifier, int val, boolean is3Byte)
          Create an XIDParameter with a 3- or 4-byte value.
XIDParameter(byte paramIdentifier, short val)
          Create an XIDParameter with a 2-byte value.
 
Method Summary
 byte getParamLength()
          Get the length of the parameter's value.
static XIDParameter read(java.io.DataInput dis)
          Read an XIDParameter from a byte stream.
 java.lang.String toString()
          Returns a string representation of the XIDParameter object.
 void write(java.io.DataOutput dos)
          Write the XIDParameter to a byte stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_VALUE

public static final byte[] EMPTY_VALUE

paramIdentifier

public byte paramIdentifier

paramValue

public byte[] paramValue
Constructor Detail

XIDParameter

public XIDParameter(byte paramIdentifier)
Create an XIDParameter with an empty value (presence implies the value).

Parameters:
paramIdentifier - identifier code

XIDParameter

public XIDParameter(byte paramIdentifier,
                    byte val)
Create an XIDParameter with a 1-byte value.

Parameters:
paramIdentifier - identifier code
val - value of parameter

XIDParameter

public XIDParameter(byte paramIdentifier,
                    short val)
Create an XIDParameter with a 2-byte value.

Parameters:
paramIdentifier - identifier code
val - value of parameter

XIDParameter

public XIDParameter(byte paramIdentifier,
                    int val,
                    boolean is3Byte)
Create an XIDParameter with a 3- or 4-byte value.

Parameters:
paramIdentifier - identifier code
val - value of parameter
is3Byte - boolean true if value only requires 24 bits to encode
Method Detail

getParamLength

public byte getParamLength()
Get the length of the parameter's value.

Returns:
length of value in octets (bytes)

write

public void write(java.io.DataOutput dos)
           throws java.io.IOException
Write the XIDParameter to a byte stream.

Parameters:
dos - DataOutput to write the value to
Throws:
java.io.IOException - if write fails for any reason

read

public static XIDParameter read(java.io.DataInput dis)
                         throws java.io.IOException
Read an XIDParameter from a byte stream.

Parameters:
dis - DataInput to read the parameter from
Returns:
decoded XIDParameter element
Throws:
java.io.IOException - if read fails for any reason

toString

public java.lang.String toString()
Returns a string representation of the XIDParameter object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.