SmppHelper
public class SmppHelper
Extends: java.lang.Object
SmppHelper is a utility class that provides helper methods and constants for working with SMPP-specific message formats, TLV tags, delivery reports, short message parsing, and encoding/decoding operations. It is designed to simplify common tasks involved in handling SMPP protocol details at a low level.
This class contains a collection of static fields and static methods. You don’t need to create an object of this class — just use its static methods and constants.
Fields:
The static fields in SmppHelper serve two main purposes:
- TLV Tag Constants – Represent common optional parameter identifiers used in SMPP PDUs.
- Delivery Report Tokens – Provide string constants used for constructing and parsing delivery reports.
Field | Type | Description |
TAG_RECEIPTED_MSG_ID | short | TLV tag for the ID of the receipted message. |
TAG_MESSAGE_PAYLOAD | short | TLV tag for the raw message payload. |
TAG_MSG_STATE | short | TLV tag for message state in delivery reports. |
TAG_MSG_REF_NUM | short | TLV tag used for message concatenation tracking. |
TAG_LANGUAGE_INDICATOR | short | TLV tag for language indicator. |
TAG_SEGMENT_SEQNUM | short | TLV tag for UDH segment sequence number. |
TAG_TOTAL_SEGMENTS | short | TLV tag for total number of segments. |
DELIVERY_ACK_ID | String | Token for id: field in delivery receipts. |
DELIVERY_ACK_SUB | String | Token for sub: field (submitted count). |
DELIVERY_ACK_DLVRD | String | Token for dlvrd: field (delivered count). |
DELIVERY_ACK_SUBMIT_DATE | String | Token for submit date: field. |
DELIVERY_ACK_DONE_DATE | String | Token for done date: field. |
DELIVERY_ACK_STAT | String | Token for stat: field (delivery status). |
DELIVERY_ACK_ERR | String | Token for err: field (error code). |
DELIVERY_ACK_TEXT | String | Token for text: field (message preview). |
DELIVERY_ACK_DATE_FORMAT | SimpleDateFormat | Date format used for parsing delivery report timestamps. |
Constructor:
public SmppHelper()
Standard constructor, though this class is used statically and instantiation is not necessary.
Methods:
Date parseSmppDate(String val) |
Parses a string-formatted SMPP absolute date into a Date. Throws: ParseException |
String printSmppAbsoluteDate(Long date, int timezoneOffset) | Formats a timestamp into SMPP absolute date string format. |
String parseShortMessageText(DeliverSm event) |
Extracts readable text from a DeliverSm PDU. Throws: UnsupportedEncodingException |
String createDeliveryReport(...) | Constructs a formatted delivery report string with status and timestamps. |
byte[] getShortMessageUserData(byte[] shortMessage) |
Extracts the user data portion from a short message. Throws: IllegalArgumentException |
byte[] getShortMessageUserDataHeader(byte[] shortMessage) |
Extracts UDH portion from a short message. Throws: IllegalArgumentException |
boolean isUserDataHeaderIndicatorEnabled(byte esmClass) | Checks if the UDH indicator bit is enabled in the ESM class. |
boolean isMessageTypeAnyDeliveryReceipt(byte esmClass) | Determines whether the message is a delivery receipt. |
ShiftType getShiftType(byte[] udh) | Extracts shift type from the user data header. |
Language getLanguage(byte[] udh) | Extracts the language from UDH. |
String translateMessage(Encoding encoding, byte[] data, byte[] udh) | Decodes a message based on encoding and optional UDH. |
byte[] translateMessage(Encoding encoding, String data, ShiftType shiftType, Language language) | Encodes a message with specified encoding, shift type, and language. |
String bytesToHex(byte[] bytes) | Converts a byte array into a hexadecimal string. |
Methods inherited from class java.lang.Object |
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Start innovating with Mobius
What's next? Let's talk!