Class GSM7PACKEDStringCodec<T>
- java.lang.Object
-
- com.opencloud.slee.resources.in.datatypes.sms.GSM7PACKEDStringCodec<T>
-
- All Implemented Interfaces:
StringCodec<T>
,Serializable
public final class GSM7PACKEDStringCodec<T> extends Object implements StringCodec<T>
Implements a StringCodec for the case of GSM7 characters encoded in packed 7-bit format.- 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, expecting 7-bit packed format of GSM7 characters, deciding whether there are 1 or 8 bits used in the last octet based on whether its index is a multiple of 7 and the 7 bits are all 0.String
decodeString(byte[] encoded, StringIndicators indicators)
Decodes a String of characters from a byte array, expecting 7-bit packed format of GSM7 characters, using the given indicators to distinguish whether 1 or 8 bits are used in the last octet.byte[]
encodeString(String string)
Encodes a String of characters to a byte array, accepting only GSM7 characters and encoding them in 7-bit packed format.byte[]
encodeString(String string, StringIndicators indicators)
Encodes a String of characters to a byte array, accepting only GSM7 characters and encoding them in 7-bit packed format.GSM7PACKEDStringCodec<T>
getLaxDecoder()
Gets the standard GSM7PACKEDStringCodec.static <T> GSM7PACKEDStringCodec<T>
getStandardCodec()
Gets the standard GSM7PACKEDStringCodec.
-
-
-
Method Detail
-
getStandardCodec
public static <T> GSM7PACKEDStringCodec<T> getStandardCodec()
Gets the standard GSM7PACKEDStringCodec.- Returns:
- GSM7PACKEDStringCodec
-
getLaxDecoder
public GSM7PACKEDStringCodec<T> getLaxDecoder()
Gets the standard GSM7PACKEDStringCodec. This method is required by interface StringCodec, but it needn't return a different GSM7PACKEDStringCodec as all encodings can be decoded.- Specified by:
getLaxDecoder
in interfaceStringCodec<T>
- Returns:
- GSM7PACKEDStringCodec
-
encodeString
public byte[] encodeString(String string, StringIndicators indicators)
Encodes a String of characters to a byte array, accepting only GSM7 characters and encoding them in 7-bit packed format. Sets indicators to assist decoding by this or 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 any character of the given String is not a GSM7 character
-
encodeString
public byte[] encodeString(String string)
Encodes a String of characters to a byte array, accepting only GSM7 characters and encoding them in 7-bit packed format.- 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 any character of the given String is not a GSM7 character
-
decodeString
public String decodeString(byte[] encoded, StringIndicators indicators)
Decodes a String of characters from a byte array, expecting 7-bit packed format of GSM7 characters, using the given indicators to distinguish whether 1 or 8 bits are used in the last octet.- Specified by:
decodeString
in interfaceStringCodec<T>
- Parameters:
encoded
- the byte array to be decoded to a Stringindicators
- indicator values needed for decoding- Returns:
- the decoded String
-
decodeString
public String decodeString(byte[] encoded)
Decodes a String of characters from a byte array, expecting 7-bit packed format of GSM7 characters, deciding whether there are 1 or 8 bits used in the last octet based on whether its index is a multiple of 7 and the 7 bits are all 0.- Specified by:
decodeString
in interfaceStringCodec<T>
- Parameters:
encoded
- the byte array to be decoded to a String- Returns:
- the decoded String
-
-