public class Message extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Message.GregorDesignation
This interface defines special conversion of source objects to 16-char
long strings in the message fields.
|
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
data
The data of the message.
|
private String |
dest
Destination of this message.
|
private short |
flags
The flag field consits of thw bytes, represented as a short.
|
static short |
GREC
Grec bit in flags.
|
private int |
id
Each message has a unique serial number, represented as an int.
|
private static int |
ID
The current value.
|
static short |
PACE
PacE bit in flags.
|
static short |
RPLY
RPLY bit in flags.
|
private String |
src
The source of this message.
|
static short |
URG
URG bit in flags.
|
| Modifier | Constructor and Description |
|---|---|
|
Message(Object src,
Object dest)
Creates a message, specifying src and destination.
|
|
Message(Object src,
Object dest,
byte[] ascii)
Creates amessage with source, destination and data section.
|
|
Message(Object src,
Object dest,
byte[] ascii,
short fl)
Creates amessage with source, destination, data section and flags.
|
protected |
Message(Object src,
Object dest,
byte[] ascii,
short fl,
int i)
Full constructor, hidden from the outside.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFlag(short mask)
Adds one of the defined flags to the current flag setting.
|
byte[] |
getData()
Returns the data of this message.
|
int |
getDataLength()
Returns the data length of this message.
|
String |
getDestination()
Returns the message destination as a 16-byte long string.
|
short |
getFlags()
Returns the data flags.
|
int |
getID()
Returns the serial ID of this message.
|
protected static int |
getNextId()
Returns the next id readily as an integer.
|
String |
getPayload()
Returns the data part of the message or the empty string if no data is carried.
|
String |
getSource()
Returns the message source as a 16-byte long string.
|
static String |
getString16(Object o)
If the object implements GregorDesignation, we convert it according
to this interface, otherwise the toString method is used.
|
int |
hashCode()
Returns the unique ID as the hash.
|
boolean |
isGrec()
Test the message for grec-interpretation.
|
boolean |
isPace()
Test the message for pace-interpretation
|
boolean |
isReply()
Test the message for urgency.
|
boolean |
isUrgent()
Test the message for urgency.
|
void |
setData(byte[] ascii)
Sets the data of this message.
|
void |
setFlags(short fl)
Updates the flags.
|
protected void |
setID(int i)
Sets the unique ID of this message.
|
protected boolean |
testFlags(short mask)
Test a bit mask.
|
String |
toString()
Returns a descriptive string of this message including field
declarations.
|
String |
toString(boolean multiline)
Returns a descriptive string of this message including field
declarations.
|
public static final short PACE
public static final short GREC
public static final short URG
public static final short RPLY
private short flags
private int id
private String src
private String dest
private byte[] data
private static int ID
public Message(Object src, Object dest, byte[] ascii)
public Message(Object src, Object dest, byte[] ascii, short fl)
protected static int getNextId()
public int hashCode()
public String getSource()
public String getDestination()
public void setData(byte[] ascii)
public byte[] getData()
public int getDataLength()
public void setFlags(short fl)
public void addFlag(short mask)
public short getFlags()
public boolean isUrgent()
public boolean isPace()
public boolean isGrec()
public boolean isReply()
public int getID()
protected boolean testFlags(short mask)
protected void setID(int i)
public String toString()
public String toString(boolean multiline)
public String getPayload()