Class IA5StringCodec<T>
- java.lang.Object
-
- com.opencloud.slee.resources.in.datatypes.IA5StringCodec<T>
-
- All Implemented Interfaces:
StringCodec<T>
,Serializable
public final class IA5StringCodec<T> extends Object implements StringCodec<T>
Implements a StringCodec for the case of ASCII/ISO646-US characters encoded in octets.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
decodeString(byte[] encoded)
Decodes a String of characters from a byte array, taking all values (regardless of given odd), expecting only values [0,127], and decoding them to ASCII/ISO646-US characters.String
decodeString(byte[] encoded, StringIndicators indicators)
Decodes a String of characters from a byte array, taking all values (regardless of given odd), expecting only values [0,127], and decoding them to ASCII/ISO646-US characters.byte[]
encodeString(String string)
Encodes a String of characters to a byte array, accepting only ASCII/ISO646-US characters, and encoding each character according to that character set.byte[]
encodeString(String string, StringIndicators indicators)
Encodes a String of characters to a byte array, accepting only ASCII/ISO646-US characters, and encoding each character according to that character set.IA5StringCodec<T>
getLaxDecoder()
Gets an IA5StringCodec like the standard one except that decoding invalid characters produces ? characters instead of throwing an exception.static <T> IA5StringCodec<T>
getStandardCodec()
Gets the standard IA5StringCodec.
-
-
-
Method Detail
-
getStandardCodec
public static <T> IA5StringCodec<T> getStandardCodec()
Gets the standard IA5StringCodec.- Returns:
- IA5StringCodec
-
getLaxDecoder
public IA5StringCodec<T> getLaxDecoder()
Gets an IA5StringCodec like the standard one except that decoding invalid characters produces ? characters instead of throwing an exception. The lax decoder of a lax decoder is itself (idempotent).- Specified by:
getLaxDecoder
in interfaceStringCodec<T>
- Returns:
- StringCodec
-
encodeString
public byte[] encodeString(String string, StringIndicators indicators)
Encodes a String of characters to a byte array, accepting only ASCII/ISO646-US characters, and encoding each character according to that character set. Sets an indicator to assist decoding by other StringCodecs.- Specified by:
encodeString
in interfaceStringCodec<T>
- Parameters:
string
- the String to be encoded to a byte arrayindicators
- the StringIndicators object in which to set the indicators- Returns:
- the encoded byte array
- Throws:
UnsupportedDigitException
- if a non-ASCII character is found
-
encodeString
public byte[] encodeString(String string)
Encodes a String of characters to a byte array, accepting only ASCII/ISO646-US characters, and encoding each character according to that character set.- Specified by:
encodeString
in interfaceStringCodec<T>
- Parameters:
string
- the String to be encoded to a byte array- Returns:
- the encoded byte array
- Throws:
UnsupportedDigitException
- if a non-ASCII character is found
-
decodeString
public String decodeString(byte[] encoded, StringIndicators indicators)
Decodes a String of characters from a byte array, taking all values (regardless of given odd), expecting only values [0,127], and decoding them to ASCII/ISO646-US characters. If a value outside the range [0,127] is found, the standard decoder throws UnsupportedDigitException, while the lax decoder decodes a ? character.- Specified by:
decodeString
in interfaceStringCodec<T>
- Parameters:
encoded
- the byte array to be decoded to a Stringindicators
- indicator values needed for decoding (ignored)- Returns:
- the decoded String
- Throws:
UnsupportedDigitException
- if any encoded content is not in range [0,127]
-
decodeString
public String decodeString(byte[] encoded)
Decodes a String of characters from a byte array, taking all values (regardless of given odd), expecting only values [0,127], and decoding them to ASCII/ISO646-US characters. If a value outside the range [0,127] is found, the standard decoder throws UnsupportedDigitException, while the lax decoder decodes a ? character.- Specified by:
decodeString
in interfaceStringCodec<T>
- Parameters:
encoded
- the byte array to be decoded to a String- Returns:
- the decoded String
- Throws:
UnsupportedDigitException
- if any encoded content is not in range [0,127]
-
-