Every field format element is a subclass of com.ibm.btt.format.FieldFormat. Because there are different types of data field, there are different kinds of field format element accordingly. The attributes of field format element customizes their behavior in the formatting and unformatting process. The classes listed in the following table are all in the package com.ibm.btt.format.impl.
Class | Attributes | Sample definition |
---|---|---|
StringFormat (Format/unformat a data field which is in type of java.lang.String) |
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. |
<fString dataName="name" encoding="cp937"/> |
IntegerFormat (Format/unformat a data field which is in type of byte, short, int or long) |
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. |
<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. |
FloatFormat (Format/unformat a data field which is in type of float or double) |
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. |
<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 |
PackedFormat (Format/unformat a data field which is in type of float/double/integer/long, target message is byte representation of the data field) |
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 |
<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). |
PackedDateFormat (Format/unformat a data field which is in type of Date) |
N/A | <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). |