public final class ISO646BCDStringCodec<T> extends Object implements StringCodec<T>
Modifier and Type | Method and Description |
---|---|
String |
decodeString(byte[] encoded)
Decodes a String of characters from a byte array,
taking digits from all semi-octets left-to-right in pairs,
expecting only values [0,95], adding 32,
and converting to the printable ASCII/ISO646-US character of that code.
|
String |
decodeString(byte[] encoded,
StringIndicators indicators)
Decodes a String of characters from a byte array,
taking digits from all semi-octets left-to-right in pairs,
expecting only values [0,95], adding 32,
and converting to the printable ASCII/ISO646-US character of that code.
|
byte[] |
encodeString(String string)
Encodes a String of characters to a byte array,
accepting only printable ASCII/ISO646-US characters,
and encoding each character in an octet by taking its ASCII code, subtracting 32,
and encoding each of the resulting two decimal digits in a semi-octet,
with the semi-octets written left-to-right.
|
byte[] |
encodeString(String string,
StringIndicators indicators)
Encodes a String of characters to a byte array,
accepting only printable ASCII/ISO646-US characters,
and encoding each character in an octet by taking its ASCII code, subtracting 32,
and encoding each of the resulting two decimal digits in a semi-octet,
with the semi-octets written left-to-right.
|
ISO646BCDStringCodec<T> |
getLaxDecoder()
Gets an ISO646BCDStringCodec like the standard one except that decoding invalid characters
produces ? characters instead of throwing an exception.
|
static <T> ISO646BCDStringCodec<T> |
getStandardCodec()
Gets the standard ISO646BCDStringCodec.
|
public static <T> ISO646BCDStringCodec<T> getStandardCodec()
public ISO646BCDStringCodec<T> getLaxDecoder()
getLaxDecoder
in interface StringCodec<T>
public byte[] encodeString(String string, StringIndicators indicators)
encodeString
in interface StringCodec<T>
string
- the String to be encoded to a byte arrayindicators
- the StringIndicators object in which to set the indicatorsUnsupportedDigitException
- if a non-printable-ASCII character is foundpublic byte[] encodeString(String string)
encodeString
in interface StringCodec<T>
string
- the String to be encoded to a byte arrayUnsupportedDigitException
- if a non-printable-ASCII character is foundpublic String decodeString(byte[] encoded, StringIndicators indicators)
decodeString
in interface StringCodec<T>
encoded
- the byte array to be decoded to a Stringindicators
- indicators indicator values needed for decoding (ignored)UnsupportedDigitException
- if any encoded content is not in range [0,127]public String decodeString(byte[] encoded)
decodeString
in interface StringCodec<T>
encoded
- the byte array to be decoded to a StringUnsupportedDigitException
- if any encoded content is not in range [0,127]