Package org.whiteflagprotocol.java.core
Enum Class WfMessageCodec.Encoding
- All Implemented Interfaces:
Serializable
,Comparable<WfMessageCodec.Encoding>
,Constable
- Enclosing class:
- WfMessageCodec
Whiteflag message compressed field encodings
Whiteflag fields use these compressed encodings, as defined for each message field in the Whiteflag specification.
- Since:
- 1.1
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescription1-bit binary encoded bit4-bit binary encoded date-time coordinate4-bit binary encoded decimal4-bit binary encoded time duration4-bit binary encoded hexadecimal4-bit binary encoded latitude coordinate4-bit binary encoded longitude coordinate8-bit binary encoded 1-byte UTF-8 character -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the bit length the totol number of bits for a fixed length field, else the bits to encode a single characterint
bitLength
(int byteLength) Returns the bit length of a field for a given encoding and unencoded field byte lengthint
Returns the byte length for a fixed length unencoded field, else -1charset()
Returns the allowed charters for a given encodingboolean
Checks if this encoding requires a fixed field lengthregex()
Returns the generic regular expression for a given encodingstatic WfMessageCodec.Encoding
Returns the enum constant of this class with the specified name.static WfMessageCodec.Encoding[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BIN
1-bit binary encoded bit -
DEC
4-bit binary encoded decimal -
HEX
4-bit binary encoded hexadecimal -
UTF8
8-bit binary encoded 1-byte UTF-8 character -
DATETIME
4-bit binary encoded date-time coordinate -
DURATION
4-bit binary encoded time duration -
LAT
4-bit binary encoded latitude coordinate -
LONG
4-bit binary encoded longitude coordinate
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
charset
Returns the allowed charters for a given encoding- Returns:
- a regex character set, e.g. [0-9]
-
regex
Returns the generic regular expression for a given encoding- Returns:
- a regex expression
-
isFixedLength
public boolean isFixedLength()Checks if this encoding requires a fixed field length- Returns:
- TRUE if the encoding requires a fixed field length
-
byteLength
public int byteLength()Returns the byte length for a fixed length unencoded field, else -1- Returns:
- the byte length for a fixed length unencoded field, or -1 for variable length fields
-
bitLength
public int bitLength()Returns the bit length the totol number of bits for a fixed length field, else the bits to encode a single character- Returns:
- the bit length for a fixed length encoded field, or the bits to encode a single character of a
-
bitLength
public int bitLength(int byteLength) Returns the bit length of a field for a given encoding and unencoded field byte length- Parameters:
byteLength
- the number of bytes in the unencoded field- Returns:
- the number of bits in a compressed encoded field
-