public class BinaryStringCodec<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 length values from octets,
rejecting any value that isn't in range [0,9],
and decoding to characters ['0','9'].
|
String |
decodeString(byte[] encoded,
StringIndicators indicators)
Decodes a String of characters from a byte array,
taking length values from octets,
rejecting any value that isn't in range [0,9],
and decoding to characters ['0','9'].
|
byte[] |
encodeCharArray(char[] chars)
Encodes an array of characters to a byte array,
accepting only decimal digit characters ['0','9'],
and encoding each digit in an octet as [0,9].
|
byte[] |
encodeString(String string)
Encodes a String of characters to a byte array,
accepting only decimal digit characters ['0','9'],
and encoding each digit in an octet as [0,9].
|
byte[] |
encodeString(String string,
StringIndicators indicators)
Encodes a String of characters to a byte array,
accepting only decimal digit characters ['0','9'],
and encoding each digit in an octet as [0,9].
|
BinaryStringCodec<T> |
getLaxDecoder()
Gets a BinaryStringCodec that decodes invalid characters to ? characters
instead of throwing an exception.
|
static <T> BinaryStringCodec<T> |
getStandardCodec()
Gets the standard BinaryStringCodec.
|
public static <T> BinaryStringCodec<T> getStandardCodec()
public BinaryStringCodec<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 any character of the given String is not a decimal digitpublic byte[] encodeString(String string)
encodeString
in interface StringCodec<T>
string
- the String to be encoded to a byte arrayUnsupportedDigitException
- if any character of the given String is not a decimal digitpublic byte[] encodeCharArray(char[] chars)
chars
- the character array to be encoded to a byte arrayUnsupportedDigitException
- if any character of the given String is not a decimal digitpublic String decodeString(byte[] encoded, StringIndicators indicators)
decodeString
in interface StringCodec<T>
encoded
- the byte array to be decoded to a Stringindicators
- indicator values needed for decoding (ignored)UnsupportedDigitException
- if any encoded content is not in range [0,9]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,9]