ClassSample definition
|
Attributes
|
---|---|
StringFormat
(Format/unformat a data field which is in type of java.lang.String)
<fString dataName="name" encoding="cp937"/>
|
encoding:
the encoding of string. If not specified, uses default encoding of java system.
formatAs: optional values are: lowercase,uppercase and nocasecast. default value is nocasecast.
unformatAs: optional values are: lowercase,uppercase and nocasecast. default value is nocasecast.
|
IntegerFormat
(Format/unformat a data field which is in type of byte, short, int or long)
<fInteger dataName="dInt" size="int" byteOrdering="pc"/>
For example, if you format an integer value of -1024 with this format element, you will get the binary message: 00FCFFFF (hex value).
If you unformat a binary message 00FCFFFF with this format element, you will get an integer value of -1024.
|
size:
optional values are: 1(byte), 2(short), 4(int), 8(long). default value is 4.
byteOrdering:
optional values are: pc(little-endian) and host(big-endian). default value is pc.
signRule:
optional values are: yes, no. default value is yes.
|
FloatFormat
(Format/unformat a data field which is in type of float or double)
<fFloat dataName="dFloat" size="float" byteOrdering="host"/>
For example, if you format a float value of -1024.5, you will get the binary message: C4801000 (hex value). If you unformat a binary message C4801000 with this format element, you will get a float value of -1024.5
|
size:
optional values are: 4(float), 8(double) default value is 4.
byteOrdering:
optional values are: pc(little-endian) and host(big-endian). default value is pc.
|
PackedFormat
(Format/unformat a data field which is in type of float/double/integer/long, target message is byte representation of the data field)
<fPacked dataName="dDouble" decPlaces="2" type="double"/>
For example, if you format a double value of -1024.5 with this format element, you will get the binary message: 0102450D (hex value).
|
decPlaces:
an integer value which is >=0 default value is 0.
signed:
optional values are: yes, no default value is: yes
type:
optional values are: float, double, int, long default value is: int
|
PackedDateFormat
(Format/unformat a data field which is in type of Date)
<fPackedDate dataName="aDate" />
For example, if you format a Date value of Fri Apr 24 10:00:00 GMT+03:00 1998, you will get the binary message: 240498 (hex value).
|
N/A
|
ClassSample definition
|
Attributes
|
---|---|
HexDelimiter
(Add a delimiter after the binary message)
<fInteger dataName="dInt" size="int" byteOrdering="pc"/>
<hexDelim hexDelimCharStr="DDDD" /> For example, if you format an integer value of -1024 with this format element, you will get the binary message: 00FCFFFFDDDD (hex value).
|
hexDelimCharStr:
a String that represents an array of hex values.
|
FixedLength
(Adjusts a formatted binary message to a fixed length by either truncating it or by padding and justifying it)
<fString dataName="name" encoding="cp937"/>
<fixedLength length="10" alignment="right"/> For example, if you format a String “George” with this format element, you will get the binary message: 00000000C78596998785 (hex value). If you format a String “George. Wilhelm. T” with this format element, you will get the binary message: C785969987854B40E689 (hex value).
|
length:
an int value that indicates the length of the binary message.
default value is: 0.
padByte:
a byte in hex value representation. default value is: 00.
alignment:
optional values are: left, right.
default value is: left
|
MaximumLength
(Truncates the binary message if it is over the specified length. If the binary message is under the specified length, the decorator does not modify it)
<fString dataName="name" encoding="cp937"/>
<maxLength length="10"/> For example, if you format a String “George. Wilhelm. T” with this format element, you will get the binary message: C785969987854B40E689 (hex value).
|
length:
a int value that indicates the maximum length of the binary message. default value is: 0.
|
NullCheckDecorator
(Handles conversions between binary message and data field when either the binary message is empty or the data field is null)
<fString dataName="name" encoding="cp937"/>
<nullCheck/> For example, if you format a String which is null with this format element, you will get a binary message in 0 length. And if you unformat a binary message in 0 length, the format element will make no modification to the data field.
|
N/A
|
SelfLength
(Prefixes the length of the formatted binary message as an unsigned integer)
<fString dataName="name" encoding="cp937"/>
<selfLength/> For example, if you format a String “George. Wilhelm. T”, you will get the binary message: 12C785969987854B40E68993888593944B40E3 (hex value).
|
size:
the length of prefix. default value is 1.
byteOrdering:
the byte ordering of prefix. optional values are: host, pc.
default value is: pc.
lengthIncluded:
whether to include the length of prefix when calculating the length of binary message. Optional values are: yes, no Default value is: no.
|
ClassSample definition
|
Attributes
|
---|---|
FormatDefine
(used as a root format element in the format definition)
<format id="PersonFormat">
<record> <fString dataName="name" encoding="cp937"/> <selfLength/> <fInteger dataName="age" byteOrdering="host"/> <selfLength/> </record> </format> |
id:
a String that represents the id of the format definition.
|
ReferenceFormat
(handles the reference relationship between format definitions)
<format id="AnotherFormat">
<record> <fString dataName="field1" encoding="cp937"/> <selfLength/> <refFmt dataName="field2" refId="PersonFormat"/> <selfLength/> </record> </format> |
refId:
a String that represents the id of the referenced format element.
|