public class Message
extends java.lang.Object
| Constructor and Description |
|---|
Message()
Constructs a new
Message object. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add_date(int tag,
java.lang.String value)
Adds a date field to the current message.
|
boolean |
add_date2(int tag,
int year,
int month,
int day)
Adds a date field to the current message without having to construct it as a string before.
|
boolean |
add_list(int tag,
java.lang.String value)
Adds a space separated list of unsigned integers to the current message.
|
boolean |
add_long(int tag,
long value,
int decimals)
Adds a scaled integer field to the current message.
|
boolean |
add_numeric(int tag,
java.lang.String value)
Adds a numeric field to the current message.
|
boolean |
add_string(int tag,
java.lang.String value)
Adds a string field to the current message.
|
boolean |
add_time(int tag,
java.lang.String value)
Adds a time field to the current message.
|
boolean |
add_time2(int tag,
int hour,
int min,
int sec,
int msec)
Adds a time field to the current message without having to construct it as a string before.
|
boolean |
add_time3(int tag,
int hour,
int min,
int sec,
int nsec)
Adds a time field to the current message without having to construct it as a string before, with nanosecond support.
|
boolean |
add(long insref,
int mref)
Adds a new message to the message chain.
|
boolean |
addWithDelayInfo(long insref,
int mref,
int delay)
Adds a new message to the message chain.
|
boolean |
del()
Removes the current message from the message chain, marking it to be
reused.
|
protected void |
finalize() |
static Message |
fromString(java.lang.String string)
Creates a Message from the string returned from the
toString() method. |
int |
get_num_active()
Return the number of active messages in the chain.
|
int |
get_num()
Return the total number of messages in the chain.
|
boolean |
move(Message dst,
long insrefFrom,
long insrefTo)
Moves all messages with an insref matching
insrefFrom to the Message at dst
and change it to insrefTo. |
void |
reset()
Resets the message chain so it can be reused.
|
boolean |
setCompressionLevel(int level)
Sets the compression level as used by
add_string when
compressing the strings with zlib. |
boolean |
setDelay(int value)
Sets the intended delay for the current and/or future messages.
|
boolean |
setUTF8Validation(int value)
Enables (1) or Disables (0) UTF-8 validation of the string given to
add_string, the
default is Disabled (0). |
java.lang.String |
toString()
Serialize the message chain and return it as a base64 encoded string
|
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic java.lang.String toString()
toString in class java.lang.Objectpublic static Message fromString(java.lang.String string)
toString() method.string - a string returned from the toString() method of a Message classpublic boolean setCompressionLevel(int level)
add_string when
compressing the strings with zlib.level - compression level between 0-9 where 0 is Z_NO_COMPRESSION and
9 is Z_BEST_COMPRESSION. Default value is 1 (Z_BEST_SPEED).public boolean setUTF8Validation(int value)
add_string, the
default is Disabled (0).value - 1 to Enable UTF-8 validation or 0 to Disable it.public boolean setDelay(int value)
reset will not
reset the setting back to the default). The default value is DLY.BEST.value - The intended delaypublic boolean add(long insref,
int mref)
message_reference to define which message to send.insref - instrument referencemref - message referencepublic boolean addWithDelayInfo(long insref,
int mref,
int delay)
message_reference to define which message to send.insref - instrument referencemref - message referencedelay - message delaypublic boolean del()
public void reset()
del() until it returns false.public boolean add_list(int tag,
java.lang.String value)
tag - field tag to addvalue - a list of unsigned integers separated by spacepublic boolean add_numeric(int tag,
java.lang.String value)
tag - field tag to addvalue - the numeric value to add as a stringpublic boolean add_long(int tag,
long value,
int decimals)
tag - field tag to addvalue - the scaled integer valuedecimals - the number of fixed decimals in the scaled integerpublic boolean add_string(int tag,
java.lang.String value)
tag - field tag to addvalue - the string to addpublic boolean add_date(int tag,
java.lang.String value)
tag - field tag to addvalue - the date as a string in "YYYY-MM-DD", "YYYY-MM", "YYYY-Hx", "YYYY-Tx", "YYYY-Qx" or "YYYY-Wxx" formatpublic boolean add_date2(int tag,
int year,
int month,
int day)
tag - field tag to addyear - the Year part of the date to addmonth - the Month part of the date to addday - the Day part of the date to addpublic boolean add_time(int tag,
java.lang.String value)
tag - field tag to addvalue - the time as a string in "HH:MM:SS" or "HH:MM:SS.mmm" formatpublic boolean add_time2(int tag,
int hour,
int min,
int sec,
int msec)
tag - field tag to addhour - the Hour part of the timestampmin - the Minutes part of the timestampsec - the Seconds part of the timestampmsec - the Milliseconds part of the timestamppublic boolean add_time3(int tag,
int hour,
int min,
int sec,
int nsec)
tag - field tag to addhour - the Hour part of the timestampmin - the Minutes part of the timestampsec - the Seconds part of the timestampnsec - the Nanoseconds part of the timestamppublic int get_num()
get_num_active method
is that the message chain only grows as you add new messages to it and it never shrinks even after a call to reset or del.
So get_num() returns the current absolute size of the message chain, i.e the number of messages it can contain before it needs to
(automatically) be resized.public int get_num_active()
public boolean move(Message dst, long insrefFrom, long insrefTo)
insrefFrom to the Message at dst
and change it to insrefTo. If dst is set to the source object or
null then the change from insrefFrom to insrefTo will be done in-place.dst - the Message to move to or null if in-place renaming of insrefs are to be done.insrefFrom - the insref to change frominsrefTo - the insref to change to