Package org.whiteflagprotocol.java.core
Class WfMessageCodec
java.lang.Object
org.whiteflagprotocol.java.core.WfMessageCodec
Whiteflag codec utility class
This is a non-instantiatable utility class with the Whiteflag message field encoding and decoding functions, all implemented as static functions. No implementation specific properties and methods are defined by this class.
- Since:
- 1.0
- Whiteflag version:
- v1-draft.6
- Whiteflag standard x-reference:
- 4 Message Format, 4.1.2 Encoding, 4.1.3 Compression
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Whiteflag message compressed field encodings -
Method Summary
Modifier and TypeMethodDescriptionprotected static final String
decodeBDX
(byte[] buffer, int bitLength) Decodes a binary buffer into a (hexa)decimal stringprotected static final String
decodeBIN
(byte[] buffer, int bitLength) Decodes a binary buffer into a binary stringstatic final String
decodeField
(WfMessageField field, byte[] buffer) Sets the field value from a binary bufferprotected static final byte[]
Encodes a (hexa)decimal string into a binary bufferprotected static final byte[]
Encodes a binary string into a binary bufferstatic final byte[]
encodeField
(WfMessageField field) Encodes a Whiteflag message field to compressed binary representationprotected static final byte[]
encodeLatLong
(String datumstr) Encodes a datum string into binary buffer
-
Method Details
-
encodeField
Encodes a Whiteflag message field to compressed binary representation- Parameters:
field
- the message field to be encoded- Returns:
- a binary buffer with the encoded field
- Since:
- 1.1
-
decodeField
Sets the field value from a binary buffer- Parameters:
field
- the field for which to decode the binary valuebuffer
- a binary buffer with the compressed binary encoded field data- Returns:
- the uncompressed value of the field
- Since:
- 1.1
-
encodeBIN
Encodes a binary string into a binary buffer- Parameters:
binstr
- the binary string to encode- Returns:
- a binary buffer containing the bits from the binary string
- Since:
- 1.1
-
decodeBIN
Decodes a binary buffer into a binary string- Parameters:
buffer
- the binary buffer to decodebitLength
- the buffer length, i.e. the number of bits in the buffer to decode- Returns:
- a binary string containing the bits from the binary buffer
- Since:
- 1.1
-
encodeBDX
Encodes a (hexa)decimal string into a binary buffer- Parameters:
bdxstr
- the (hexa)decimal string to encode- Returns:
- a binary buffer containing the encoded (hexa)decimal string
- Since:
- 1.1
-
decodeBDX
Decodes a binary buffer into a (hexa)decimal string- Parameters:
buffer
- the binary buffer containing the binary encoded (hexa)decimals to decodebitLength
- the buffer length, i.e. the number of bits in the buffer to decode- Returns:
- a (hexa)decimal string with the decoded data
- Since:
- 1.1
-
encodeLatLong
Encodes a datum string into binary buffer- Parameters:
datumstr
- the datum string to encode- Returns:
- a binary buffer containing the encoded datum
- Since:
- 1.1
-