public abstract class DictionaryUtil
extends java.lang.Object
Constructor and Description |
---|
DictionaryUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
fixedWidthHexString(int value,
int width)
Simple function which returns a hexadecimal string with a minimum fixed
width given a value to convert to hex.
|
static byte[] |
getInverseValue(java.lang.String key,
java.lang.String[] inverseDictionary,
java.text.Collator c)
Returns the hex value for the the unique word which is the key in the
inverse dictionary.
|
static byte[] |
hexStringToByteArray(java.lang.String hexString)
Simple utility function which takes a hex string and returns a byte
array containing the hex values.
|
public static byte[] getInverseValue(java.lang.String key, java.lang.String[] inverseDictionary, java.text.Collator c) throws java.lang.IllegalArgumentException, java.lang.Exception
key
- The unique word which is the key to lookup the value for in the inverse dictionaryinverseDictionary
- The INVERSE unique dictionary for mapping words to hex values (keys)c
- The comparator to use for performing comparisons when looking up words in thejava.lang.IllegalArgumentException
- If the key is nulljava.lang.Exception
- If the value is not found in the inverse dictionarypublic static java.lang.String fixedWidthHexString(int value, int width) throws DataLengthException
value
- The integer value to convert to a hex stringminWidth
- The width of the hex string, the width must be a multiple
of two such as four, leading 0's will be added to match the widthDataLengthException
- If the width is not a multiple of twopublic static byte[] hexStringToByteArray(java.lang.String hexString) throws DataLengthException, java.lang.IllegalArgumentException
hexString
- A string containing hex values, must have a length that
is a multiple of twoDataLengthException
- If the length of hexString is not a multiple of twojava.lang.IllegalArgumentException
- If the hex string does not contain hex values