Reality Interface Classes

com.northgateis.comms.dda
Class DDAMsg

java.lang.Object
  |
  +--com.northgateis.comms.dda.DDAMsg

public class DDAMsg
extends java.lang.Object

RealityX DDA Message class

This class defines a DDA message and provides various constructors and methods for accessing the fields.

See the DDATcp class for typical usage.


Field Summary
static int MAX_FUNCTION_CODE
          The maximimum value for a function code
static int MAX_QUALIFIER_LEN
          The maximimum lenght of a qualfier array
static int MAX_REFERENCE
          The maximimum calue for a reference
 
Constructor Summary
DDAMsg()
          Construct an empty DDA message
DDAMsg(int func, int ref)
          Construct a DDA message with empty data and qualifier
DDAMsg(int func, int ref, byte[] data)
          Construct a DDA message with empty qualifier
DDAMsg(int func, int ref, byte[] qualifier, byte[] data)
          Construct a full DDA message
 
Method Summary
 void build(java.io.InputStream is)
          Read a message from the given input stream and use it to overwrite the current message.
 byte[] getBytes()
          Serialise the message into a byte array and return it
 byte[] getData()
          Get the data block
 int getDataLength()
          Get the data length
 int getFunction()
          Get the function code
 byte[] getQualifier()
          Get the qualifier
 int getQualifierInt()
          Get the qualifier
 int getQualifierLength()
          Get the qualifier length
 int getReference()
          Get the reference
 void setData(byte[] buf)
          Set the data block
 void setData(java.lang.String s)
          Set the data block
 void setFunction(int func)
          Set the function code
 void setQualifier(byte[] buf)
          Set the qualifier
 void setQualifier(java.lang.String s)
          Set the qualifier
 void setReference(int ref)
          Set the reference
 java.lang.String toString()
          Convert the message to a human readable format
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_FUNCTION_CODE

public static final int MAX_FUNCTION_CODE
The maximimum value for a function code

MAX_REFERENCE

public static final int MAX_REFERENCE
The maximimum calue for a reference

MAX_QUALIFIER_LEN

public static final int MAX_QUALIFIER_LEN
The maximimum lenght of a qualfier array
Constructor Detail

DDAMsg

public DDAMsg()
Construct an empty DDA message

DDAMsg

public DDAMsg(int func,
              int ref,
              byte[] qualifier,
              byte[] data)
Construct a full DDA message
Parameters:
func - Integer function code in range 0 to 65535
ref - Integer reference in range 0 to 255
qualifier - Byte array containing qualifier (Max 255 bytes long)
data - Byte array containing data (Max 4G bytes long)

DDAMsg

public DDAMsg(int func,
              int ref,
              byte[] data)
Construct a DDA message with empty qualifier
Parameters:
func - Integer function code in range 0 to 65535
ref - Integer reference in range 0 to 255
data - Byte array containing data (Max 4G bytes long)

DDAMsg

public DDAMsg(int func,
              int ref)
Construct a DDA message with empty data and qualifier
Parameters:
func - Integer function code in range 0 to 65535
ref - Integer reference in range 0 to 255
Method Detail

setFunction

public void setFunction(int func)
Set the function code
Parameters:
func - Integer function code in range 0 to 65535

setReference

public void setReference(int ref)
Set the reference
Parameters:
ref - Integer reference in range 0 to 255

setQualifier

public void setQualifier(byte[] buf)
Set the qualifier
Parameters:
buf - Byte array containing qualifier (Max 255 bytes long)

setQualifier

public void setQualifier(java.lang.String s)
Set the qualifier
Parameters:
s - String containing qualifier (Max 255 bytes long)

setData

public void setData(byte[] buf)
Set the data block
Parameters:
buf - Byte array containing data (Max 4G bytes long)

setData

public void setData(java.lang.String s)
Set the data block
Parameters:
s - String containing data (Max 4G bytes long)

getFunction

public int getFunction()
Get the function code
Returns:
Integer function code

getReference

public int getReference()
Get the reference
Returns:
Integer reference

getQualifierLength

public int getQualifierLength()
Get the qualifier length
Returns:
Integer length of qualifier

getDataLength

public int getDataLength()
Get the data length
Returns:
Integer length of data buffer

getQualifier

public byte[] getQualifier()
Get the qualifier
Returns:
pointer to the byte array qualifier buffer

getQualifierInt

public int getQualifierInt()
Get the qualifier
Returns:
The qualifier interpreted as an ASCII integer

getData

public byte[] getData()
Get the data block
Returns:
pointer to the byte array data buffer

getBytes

public byte[] getBytes()
Serialise the message into a byte array and return it
Returns:
a new byte array containing the serialised message

build

public void build(java.io.InputStream is)
           throws java.io.IOException
Read a message from the given input stream and use it to overwrite the current message.
Parameters:
is - an input stream
Throws:
java.io.IOException - if an input or output exception occurs

toString

public java.lang.String toString()
Convert the message to a human readable format
Overrides:
toString in class java.lang.Object
Returns:
a Java String

Reality Interface Classes

Copyright (c) 2000 Northgate Information Solutions