ie.omk.smpp.util
Class MessageEncoding

java.lang.Object
  extended by ie.omk.smpp.util.MessageEncoding
Direct Known Subclasses:
AlphabetEncoding, BinaryEncoding

public abstract class MessageEncoding
extends Object


Constructor Summary
protected MessageEncoding(int dataCoding)
           
 
Method Summary
 int getDataCoding()
          Get the correct data_coding value for this message encoding type.
 int getEncodingLength()
          Get the number of bits each encoded message byte represents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageEncoding

protected MessageEncoding(int dataCoding)
Method Detail

getDataCoding

public final int getDataCoding()
Get the correct data_coding value for this message encoding type.


getEncodingLength

public int getEncodingLength()
Get the number of bits each encoded message byte represents. This method will almost always return 8. The only known situation at this time where the value should be different is in DefaultAlphabetEncoding. The reason is that, although the DefaultAlphabetEncoding will generate encoded message byte arrays with one character in each byte location, in reality each byte actually represents only 7-bits. When the message is re-encoded at the SMSC, it will be compressed. This is how the GSM default alphabet can fit 160 characters into a 140-byte payload. Most SMSCs, however, accept the message in its uncompressed form.

It is not correct to return a value of 16 from an AlphabetEncoding which encodes characters in 2 or more bytes. The reason that, although a character is encoding as 2 bytes, in the encoded form each byte location still represents 8 bits . This is an important distinction.



Copyright © 2011 smppapi at Sourceforge. All Rights Reserved.