|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jlab.coda.cMsg.cMsgPayloadItem
public final class cMsgPayloadItem
This class represents an item in a cMsg message's payload. The value of each item is stored in this class along with a text representation of that item. Following is the text format of various types of payload items where [nl] means newline.
Note that there is only 1 space or newline between all entries. The only exception to the 1 space spacing is between the last two entries on each "header" line (the line that contains the item_name). There may be several spaces between the last 2 entries on these lines. for (arrays of) string items:item_name item_type item_count isSystemItem? item_length[nl] string_length_1[nl] string_characters_1[nl] . . . string_length_N[nl] string_characters_Nfor (arrays of) binary (converted into text) items:
item_name item_type item_count isSystemItem? item_length[nl] string_length_1 original_binary_byte_length_1 endian_1[nl] string_characters_1[nl]
. . . string_length_N original_binary_byte_length_N endian_N[nl] string_characters_N
for primitive type items:
item_name item_type item_count isSystemItem? item_length[nl] value_1 value_2 ... value_N[nl]A cMsg message is formatted as a compound payload. Each message has a number of fields (payload items). for message items:
_ item_name item_type item_count isSystemItem? item_length[nl] / message_1_in_compound_payload_text_format[nl] < field_count[nl] . \ list_of_payload_format_items . - . message_N_in_compound_payload_text_format[nl]
Constructor Summary | |
---|---|
cMsgPayloadItem(java.lang.String name,
java.math.BigInteger big)
Construct a payload item from an unsigned 64-bit integer. |
|
cMsgPayloadItem(java.lang.String name,
java.math.BigInteger[] bigs)
Construct a payload item from an array of unsigned 64-bit integers. |
|
cMsgPayloadItem(java.lang.String name,
byte b)
Construct a payload item from an 8-bit integer. |
|
cMsgPayloadItem(java.lang.String name,
byte[] b)
Construct a payload item from an array of 8-bit integers. |
|
cMsgPayloadItem(java.lang.String name,
byte[][] b)
Construct a payload item from an array of byte arrays containing binary data. |
|
cMsgPayloadItem(java.lang.String name,
byte[][] b,
int[] end)
Construct a payload item from an array of byte arrays containing binary data. |
|
cMsgPayloadItem(java.lang.String name,
byte[] b,
int end)
Construct a payload item from a byte array containing binary data. |
|
cMsgPayloadItem(java.lang.String name,
cMsgMessage msg)
Construct a payload item from a cMsgMessage object. |
|
cMsgPayloadItem(java.lang.String name,
cMsgMessage[] msgs)
Construct a payload item from an array of cMsgMessage objects. |
|
cMsgPayloadItem(java.lang.String name,
double d)
Construct a payload item from a double. |
|
cMsgPayloadItem(java.lang.String name,
double[] d)
Construct a payload item from an array of doubles. |
|
cMsgPayloadItem(java.lang.String name,
float f)
Construct a payload item from a float. |
|
cMsgPayloadItem(java.lang.String name,
float[] f)
Construct a payload item from an array of floats. |
|
cMsgPayloadItem(java.lang.String name,
int i)
Construct a payload item from a 32-bit integer. |
|
cMsgPayloadItem(java.lang.String name,
int[] i)
Construct a payload item from an array of 32-bit integers. |
|
cMsgPayloadItem(java.lang.String name,
long l)
Construct a payload item from a 64-bit integer. |
|
cMsgPayloadItem(java.lang.String name,
long[] l)
Construct a payload item from an array of 64-bit integers. |
|
cMsgPayloadItem(java.lang.String name,
short s)
Construct a payload item from a 16-bit integer. |
|
cMsgPayloadItem(java.lang.String name,
short[] s)
Construct a payload item from an array of 16-bit integers. |
|
cMsgPayloadItem(java.lang.String name,
java.lang.String s)
Construct a payload item from a String object. |
|
cMsgPayloadItem(java.lang.String name,
java.lang.String[] s)
Construct a payload item from a String array. |
|
cMsgPayloadItem(java.lang.String name,
T t)
Construct a payload item from an object implementing the Number interface. |
|
cMsgPayloadItem(java.lang.String name,
T[] ta)
Construct a payload item from an array of objects implementing the Number interface. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clone this object. |
cMsgPayloadItem |
copy()
Creates a complete copy of this object. |
java.math.BigInteger |
getBigInt()
Gets the payload item as a BigInteger object. |
java.math.BigInteger[] |
getBigIntArray()
Gets the payload item as an array of BigInteger objects. |
byte[] |
getBinary()
Gets the payload item as a byte array object holding binary data. |
byte[][] |
getBinaryArray()
Gets the payload item as an array of byte array objects holding binary data. |
byte |
getByte()
Gets the payload item as a byte (8-bit integer). |
byte[] |
getByteArray()
Gets the payload item as an array of bytes (8-bit integers). |
int |
getCount()
Get the number of elements if this payload item is an array, else return one. |
double |
getDouble()
Gets the payload item as a double. |
double[] |
getDoubleArray()
Gets the payload item as an array of doubles. |
int |
getEndian()
Get the endian value if this payload item is a byte array containing binary data. |
int[] |
getEndianArray()
Get the array of endian values if this payload item is an array of byte arrays containing binary data. |
float |
getFloat()
Gets the payload item as a float. |
float[] |
getFloatArray()
Gets the payload item as an array of floats. |
int |
getInt()
Gets the payload item as a int (32-bit integer). |
int[] |
getIntArray()
Gets the payload item as an array of ints (32-bit integers). |
java.lang.Object |
getItem()
Get the payload item itself as an object of class Object. |
long |
getLong()
Gets the payload item as a long (64-bit integer). |
long[] |
getLongArray()
Gets the payload item as an array of longs (64-bit integers). |
cMsgMessage |
getMessage()
Gets the payload item as a cMsgMessage object. |
cMsgMessage[] |
getMessageArray()
Gets the payload item as an array of cMsgMessage objects. |
java.lang.String |
getName()
Get the name of this payload item. |
short |
getShort()
Gets the payload item as a short (16-bit integer). |
short[] |
getShortArray()
Gets the payload item as an array of shorts (16-bit integers). |
java.lang.String |
getString()
Gets the payload item as a String object. |
java.lang.String[] |
getStringArray()
Gets the payload item as an array of String objects. |
java.lang.String |
getText()
Get the text representation of this payload item. |
int |
getType()
Get the type of this payload item. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public cMsgPayloadItem(java.lang.String name, java.lang.String s) throws cMsgException
name
- name of items
- string to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, java.lang.String[] s) throws cMsgException
name
- name of items
- string to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, byte[] b, int end) throws cMsgException
name
- name of itemb
- byte array containing binary data to be part of the payloadend
- endian value of the binary data (cMsgConstants.endianBig
,
cMsgConstants.endianLittle
, cMsgConstants.endianLocal
, or
cMsgConstants.endianNotLocal
)
cMsgException
- if invalid name or endian valuepublic cMsgPayloadItem(java.lang.String name, byte[][] b, int[] end) throws cMsgException
name
- name of itemb
- array of byte arrays containing binary data to be part of the payloadend
- array of endian values of the binary data (cMsgConstants.endianBig
,
cMsgConstants.endianLittle
, cMsgConstants.endianLocal
, or
cMsgConstants.endianNotLocal
)
cMsgException
- if invalid name or endian values, not enough endian values for bin arrayspublic cMsgPayloadItem(java.lang.String name, byte[][] b) throws cMsgException
name
- name of itemb
- array of byte arrays containing binary data to be part of the payload
cMsgConstants.endianLittle
, cMsgConstants.endianLocal
, or
cMsgConstants.endianNotLocal
)
cMsgException
- if invalid name or endian valuepublic cMsgPayloadItem(java.lang.String name, cMsgMessage msg) throws cMsgException
name
- name of itemmsg
- cMsgMessage object to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, cMsgMessage[] msgs) throws cMsgException
name
- name of itemmsgs
- array of cMsgMessage objects to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, byte b) throws cMsgException
name
- name of itemb
- byte (8-bit integer) to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, short s) throws cMsgException
name
- name of items
- short (16-bit integer) to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, int i) throws cMsgException
name
- name of itemi
- int (32-bit integer) to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, long l) throws cMsgException
name
- name of iteml
- long (64-bit integer) to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, java.math.BigInteger big) throws cMsgException
name
- name of itembig
- BigInteger object (containing an unsigned 64-bit integer) to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, T t) throws cMsgException
Byte
, Short
, Integer
,
Long
, Float
, or Double
.
name
- name of itemt
- Number object to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, byte[] b) throws cMsgException
name
- name of itemb
- byte array (array of 8-bit integers) to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, short[] s) throws cMsgException
name
- name of items
- short array (array of 16-bit integers) to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, int[] i) throws cMsgException
name
- name of itemi
- int array (array of 32-bit integers) to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, long[] l) throws cMsgException
name
- name of iteml
- long array (array of 64-bit integers) to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, java.math.BigInteger[] bigs) throws cMsgException
name
- name of itembigs
- array of BigInteger objects (each containing an unsigned 64-bit integer)
to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, T[] ta) throws cMsgException
Byte
, Short
, Integer
,
Long
, Float
, or Double
.
name
- name of itemta
- array of Number objects to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, float f) throws cMsgException
name
- name of itemf
- float to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, double d) throws cMsgException
name
- name of itemd
- double to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, float[] f) throws cMsgException
name
- name of itemf
- float array to be part of the payload
cMsgException
- if invalid namepublic cMsgPayloadItem(java.lang.String name, double[] d) throws cMsgException
name
- name of itemd
- double array to be part of the payload
cMsgException
- if invalid nameMethod Detail |
---|
public java.lang.Object clone()
clone
in class java.lang.Object
public cMsgPayloadItem copy()
public java.lang.String getName()
public java.lang.Object getItem()
public int getType()
cMsgConstants.payloadStr
for a String
cMsgConstants.payloadFlt
for a 4 byte float
cMsgConstants.payloadDbl
for an 8 byte float
cMsgConstants.payloadInt8
for an 8 bit int
cMsgConstants.payloadInt16
for a 16 bit int
cMsgConstants.payloadInt32
for a 32 bit int
cMsgConstants.payloadInt64
for a 64 bit int
cMsgConstants.payloadUint8
for an unsigned 8 bit int
cMsgConstants.payloadUint16
for an unsigned 16 bit int
cMsgConstants.payloadUint32
for an unsigned 32 bit int
cMsgConstants.payloadUint64
for an unsigned 64 bit int
cMsgConstants.payloadMsg
for a cMsg message
cMsgConstants.payloadBin
for binary
cMsgConstants.payloadStrA
for a String array
cMsgConstants.payloadFltA
for a 4 byte float array
cMsgConstants.payloadDblA
for an 8 byte float array
cMsgConstants.payloadInt8A
for an 8 bit int array
cMsgConstants.payloadInt16A
for a 16 bit int array
cMsgConstants.payloadInt32A
for a 32 bit int array
cMsgConstants.payloadInt64A
for a 64 bit int array
cMsgConstants.payloadUint8A
for an unsigned 8 bit int array
cMsgConstants.payloadUint16A
for an unsigned 16 bit int array
cMsgConstants.payloadUint32A
for an unsigned 32 bit int array
cMsgConstants.payloadUint64A
for an unsigned 64 bit int array
cMsgConstants.payloadMsgA
for a cMsg message array
cMsgConstants.payloadBinA
for an array of binary items
public java.lang.String getText()
public int getCount()
public int getEndian()
public int[] getEndianArray()
public java.lang.String getString() throws cMsgException
cMsgException
- if payload item is not of type cMsgConstants.payloadStr
public java.lang.String[] getStringArray() throws cMsgException
cMsgException
- if payload item is not of type cMsgConstants.payloadStrA
public byte[] getBinary() throws cMsgException
cMsgException
- if payload item is not of type cMsgConstants.payloadBin
public byte[][] getBinaryArray() throws cMsgException
cMsgException
- if payload item is not of type cMsgConstants.payloadBinA
public cMsgMessage getMessage() throws cMsgException
cMsgException
- if payload item is not of type cMsgConstants.payloadMsg
public cMsgMessage[] getMessageArray() throws cMsgException
cMsgException
- if payload item is not of type cMsgConstants.payloadMsgA
public byte getByte() throws cMsgException
cMsgException
- if payload item is not of an integer type,
or if its value is out-of-range for a bytepublic short getShort() throws cMsgException
cMsgException
- if payload item is not of an integer type,
or if its value is out-of-range for a shortpublic int getInt() throws cMsgException
cMsgException
- if payload item is not of an integer type,
or if its value is out-of-range for a intpublic long getLong() throws cMsgException
cMsgException
- if payload item is not of an integer type,
or if its value is out-of-range for a longpublic java.math.BigInteger getBigInt() throws cMsgException
cMsgException
- if payload item is not of an integer typepublic byte[] getByteArray() throws cMsgException
cMsgException
- if payload item is not of an integer array type,
or if its array values are out-of-range for a bytepublic short[] getShortArray() throws cMsgException
cMsgException
- if payload item is not of an integer array type,
or if its array values are out-of-range for a shortpublic int[] getIntArray() throws cMsgException
cMsgException
- if payload item is not of an integer array type,
or if its array values are out-of-range for a intpublic long[] getLongArray() throws cMsgException
cMsgException
- if payload item is not of an integer array type,
or if its array values are out-of-range for a longpublic java.math.BigInteger[] getBigIntArray() throws cMsgException
cMsgException
- if payload item is not of an integer array typepublic float getFloat() throws cMsgException
cMsgException
- if payload item is not of type cMsgConstants.payloadFlt
,
or it's not of type cMsgConstants.payloadDbl
and
its value is out-of-range for a floatpublic double getDouble() throws cMsgException
cMsgException
- if payload item is not of type cMsgConstants.payloadFlt
or cMsgConstants.payloadDbl
public float[] getFloatArray() throws cMsgException
cMsgException
- if payload item is not of type cMsgConstants.payloadFltA
,
or it's not of type cMsgConstants.payloadDblA
and
its values are out-of-range for a floatpublic double[] getDoubleArray() throws cMsgException
cMsgException
- if payload item is not of type cMsgConstants.payloadFltA
or cMsgConstants.payloadDblA
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |