public class BCDPlacesStringCodec<T> extends BCDStringCodec<T>
charCodec
Constructor and Description |
---|
BCDPlacesStringCodec(int before,
int after)
Constructs a 3GPP standards-based BCDPlacesStringCodec
customised to the given numbers of digits before and after the decimal point.
|
Modifier and Type | Method and Description |
---|---|
String |
decodeString(byte[] encoded)
Decodes a String containing a decimal number from a byte array,
positioning the decimal point between before and after numbers of digits,
and eliding leading 0s.
|
String |
decodeString(byte[] encoded,
StringIndicators indicators)
Decodes a String containing a decimal number from a byte array,
positioning the decimal point between before and after numbers of digits,
and eliding leading 0s.
|
byte[] |
encodeString(String string)
Encodes a String containing a decimal number to a byte array,
with each digit being encoded in a semi-octet,
aligning the encoding around particular numbers of digits before and after
the decimal point, which itself is not explicitly encoded,
padding with 0s before and after.
|
byte[] |
encodeString(String string,
StringIndicators indicators)
Encodes a String containing a decimal number to a byte array,
with each digit being encoded in a semi-octet,
aligning the encoding around particular numbers of digits before and after
the decimal point, which itself is not explicitly encoded,
padding with 0s before and after.
|
BCDPlacesStringCodec<T> |
getLaxDecoder()
Gets a BCDPlacesStringCodec that decodes invalid characters to hex digits
instead of throwing an exception.
|
getFactor, getHexVariant
public BCDPlacesStringCodec(int before, int after)
before
- number of digits before the decimal pointafter
- number of digits after the decimal pointpublic BCDPlacesStringCodec<T> getLaxDecoder()
getLaxDecoder
in interface StringCodec<T>
getLaxDecoder
in class BCDStringCodec<T>
public byte[] encodeString(String string, StringIndicators indicators)
encodeString
in interface StringCodec<T>
encodeString
in class BCDStringCodec<T>
string
- the String to be encoded to a byte arrayindicators
- the StringIndicators object in which to set the indicatorsUnsupportedDigitException
- if any character of the given String is not decimal or the '.'public byte[] encodeString(String string)
encodeString
in interface StringCodec<T>
encodeString
in class BCDStringCodec<T>
string
- the String to be encoded to a byte arrayUnsupportedDigitException
- if any character of the given String is not decimal or the '.'public String decodeString(byte[] encoded, StringIndicators indicators)
decodeString
in interface StringCodec<T>
decodeString
in class BCDStringCodec<T>
encoded
- the byte array to be decoded to a Stringindicators
- indicator values needed for decodingUnsupportedDigitException
- if any encoded content cannot be decoded by this codecpublic String decodeString(byte[] encoded)
decodeString
in interface StringCodec<T>
decodeString
in class BCDStringCodec<T>
encoded
- the byte array to be decoded to a StringUnsupportedDigitException
- if any encoded content cannot be decoded by this codec