ie.omk.smpp.util
Class AlphabetEncoding

java.lang.Object
  extended by ie.omk.smpp.util.MessageEncoding
      extended by ie.omk.smpp.util.AlphabetEncoding
Direct Known Subclasses:
ASCIIEncoding, DefaultAlphabetEncoding, HPRoman8Encoding, Latin1Encoding, UCS2Encoding, UTF16Encoding

public class AlphabetEncoding
extends MessageEncoding

SMS Alphabet to Java String mapping interface. Implementations of this interface convert Java Unicode strings into a series of bytes representing the String in a particular SMS alphabet.


Constructor Summary
protected AlphabetEncoding(int dcs)
           
 
Method Summary
 String decodeString(byte[] b)
          Convert SMS message text into a Java String.
 byte[] encodeString(String s)
          Convert a Java String into SMS message text.
 String getCharset()
          Get the character set in use by this alpabet encoding (if any).
protected  void setCharset(String charset)
          Set the charset of this alphabet encoding.
 
Methods inherited from class ie.omk.smpp.util.MessageEncoding
getDataCoding, getEncodingLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlphabetEncoding

protected AlphabetEncoding(int dcs)
Method Detail

setCharset

protected void setCharset(String charset)
                   throws UnsupportedEncodingException
Set the charset of this alphabet encoding. Sub-classes can use this to create new instances of alphabet encoding for character sets that are supported by the JVM.

Parameters:
charset - The character set to use for encoding and decoding.
Throws:
UnsupportedEncodingException - If the JVM does not support the specified character set.

getCharset

public String getCharset()
Get the character set in use by this alpabet encoding (if any).

Returns:
The character set in use by this alphabet encoding. This method may return null if the implementation is not using a JVM- supported character set.

decodeString

public String decodeString(byte[] b)
Convert SMS message text into a Java String. Implementations of this method must support decoding null. In such cases, the String "" will be returned.


encodeString

public byte[] encodeString(String s)
Convert a Java String into SMS message text. Implementations of this method must support encoding a null string. In such cases, a byte array of length 0 will be returned.



Copyright © 2011 smppapi at Sourceforge. All Rights Reserved.