|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mobicents.protocols.smpp.encoding.EncodingFactory
public class EncodingFactory
Factory class for obtaining message encoding instances. By default, instances of this class are aware of the following encoding types:
DefaultAlphabetEncodingASCIIEncodingLatin1EncodingBinaryEncodingUCS2Encoding (only if the JVM supports the UCS2 charset).Other encoding types may be added to an instance of the factory but it should be noted that there can only be one encoding mapping for any particular data coding value. If a second encoding is added which has the same data coding value as another encoding, the existing encoding will be overwritten in the factory.
The rest of the SMPPAPI uses the singleton instance of this factory
as returned by the static getInstance() method of this class.
| Constructor Summary | |
|---|---|
EncodingFactory()
|
|
| Method Summary | |
|---|---|
void |
addEncoding(Class<? extends MessageEncoding<?>> encodingClass)
Add a message encoding to this factory. |
void |
addEncoding(MessageEncoding<?> encoding)
Add a message encoding to this factory. |
Iterator<MessageEncoding<?>> |
getAllEncodings()
Get an iterator over all known encodings by this factory. |
AlphabetEncoding |
getAlphabet(String lang)
Get the SMSAlphabet needed for encoding messages in a particular language. |
AlphabetEncoding |
getDefaultAlphabet()
Return the default alphabet for this runtime environment. |
MessageEncoding<?> |
getEncoding(int dataCoding)
Get the message encoding represented by the specified data coding value. |
static EncodingFactory |
getInstance()
Get a static instance of this factory class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EncodingFactory()
| Method Detail |
|---|
public static final EncodingFactory getInstance()
EncodingFactory.public MessageEncoding<?> getEncoding(int dataCoding)
dataCoding - The data coding to retrieve a message encoding instance
for.
dataCoding or null if there is no encoding
registered for that value.public void addEncoding(MessageEncoding<?> encoding)
encoding - The encoding to add to the factory.public void addEncoding(Class<? extends MessageEncoding<?>> encodingClass)
MessageEncoding and must have a
no-argument constructor. This method will swallow any exceptions
that may occur during instance creation - primarily to silently
fail on encodings that rely on a particular charset that the current
JVM does not support. Log messages will be generated for failure
conditions.
encodingClass - The class of the MessageEncoding to
add.public Iterator<MessageEncoding<?>> getAllEncodings()
public AlphabetEncoding getDefaultAlphabet()
DefaultAlphabetEncoding. This can be altered
by setting the smpp.default_alphabet system property to the name
of an implementation of AlphabetEncoding.
For example:
java -cp .:smppapi.jar -Dsmpp.default_alphabet=myPackage.MyAlphabet
...
public AlphabetEncoding getAlphabet(String lang)
lang - The ISO code for the language the message is in.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||