Class WfMessageCodec

java.lang.Object
org.whiteflagprotocol.java.core.WfMessageCodec

public final class WfMessageCodec extends Object
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

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Whiteflag message compressed field encodings
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static final String
    decodeBDX(byte[] buffer, int bitLength)
    Decodes a binary buffer into a (hexa)decimal string
    protected static final String
    decodeBIN(byte[] buffer, int bitLength)
    Decodes a binary buffer into a binary string
    static final String
    decodeField(WfMessageField field, byte[] buffer)
    Sets the field value from a binary buffer
    protected static final byte[]
    encodeBDX(String bdxstr)
    Encodes a (hexa)decimal string into a binary buffer
    protected static final byte[]
    encodeBIN(String binstr)
    Encodes a binary string into a binary buffer
    static final byte[]
    Encodes a Whiteflag message field to compressed binary representation
    protected static final byte[]
    Encodes a datum string into binary buffer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • encodeField

      public static final byte[] encodeField(WfMessageField field)
      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

      public static final String decodeField(WfMessageField field, byte[] buffer)
      Sets the field value from a binary buffer
      Parameters:
      field - the field for which to decode the binary value
      buffer - a binary buffer with the compressed binary encoded field data
      Returns:
      the uncompressed value of the field
      Since:
      1.1
    • encodeBIN

      protected static final byte[] encodeBIN(String binstr)
      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

      protected static final String decodeBIN(byte[] buffer, int bitLength)
      Decodes a binary buffer into a binary string
      Parameters:
      buffer - the binary buffer to decode
      bitLength - 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

      protected static final byte[] encodeBDX(String bdxstr)
      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

      protected static final String decodeBDX(byte[] buffer, int bitLength)
      Decodes a binary buffer into a (hexa)decimal string
      Parameters:
      buffer - the binary buffer containing the binary encoded (hexa)decimals to decode
      bitLength - 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

      protected static final byte[] encodeLatLong(String datumstr)
      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