public abstract class SMSTPDU extends AbstractLazyEncodedByteArray
In general, accessors of all subclasses of SMSTPDU follow the following rules:
For the sake of brevity, this common behaviour is not described individually on each accessor method.
Modifier and Type | Class and Description |
---|---|
static class |
SMSTPDU.Type
Enumeration of PDU types.
|
isDecoded
encoded
FIELD_ABSENT, FIELD_UNINITIALISED
Constructor and Description |
---|
SMSTPDU()
Constructs a new SMSTPDU object with no fields set.
|
SMSTPDU(byte[] data)
Constructs a new SMSTPDU object from network-encoded data.
|
SMSTPDU(byte[] data,
int start,
int len)
Constructs a new SMSTPDU object from part of network-encoded data.
|
Modifier and Type | Method and Description |
---|---|
void |
checkFieldsSet()
Checks that all mandatory fields are present.
|
static SMSTPDU |
decodeRPAck(byte[] message)
Decode the SM-TL payload of a SM-RL RP-ACK message (positive ack of RP-MO-DATA or RP-MT-DATA)
Equivalent to
decodeRPAck(message, 0, message.length) |
static SMSTPDU |
decodeRPAck(byte[] message,
int start,
int len)
Decode the SM-TL payload of a SM-RL RP-ACK message (positive ack of RP-MO-DATA or RP-MT-DATA)
Only basic message-type decoding is performed immediately.
|
static SMSTPDU |
decodeRPError(byte[] message)
Decode the SM-TL payload of a SM-RL RP-ERROR message (negative ack of RP-MO-DATA or RP-MT-DATA).
|
static SMSTPDU |
decodeRPError(byte[] message,
int start,
int len)
Decode the SM-TL payload of a SM-RL RP-ERROR message (negative ack of RP-MO-DATA or RP-MT-DATA)
Only basic message-type decoding is performed immediately.
|
static SMSTPDU |
decodeRPMOData(byte[] message)
Decode the SM-TL payload of a SM-RL RP-MO-DATA message (TPDU transferred from MS to SC)
Equivalent to
decodeRPMOData(message, 0, message.length) |
static SMSTPDU |
decodeRPMOData(byte[] message,
int start,
int len)
Decode the SM-TL payload of a SM-RL RP-MO-DATA message (TPDU transferred from MS to SC)
Only basic message-type decoding is performed immediately.
|
static SMSTPDU |
decodeRPMTData(byte[] message)
Decode the SM-TL payload of a SM-RL RP-MT-DATA message (TPDU transferred from SC to MS)
Equivalent to
decodeRPMTData(message, 0, message.length) |
static SMSTPDU |
decodeRPMTData(byte[] message,
int start,
int len)
Decode the SM-TL payload of a SM-RL RP-MT-DATA message (TPDU transferred from SC to MS)
Only basic message-type decoding is performed immediately.
|
static byte[] |
encodeRPAck(SMSTPDU tpdu)
Encode a TPDU for sending as the payload of a SM-RL RP-ACK message.
|
static byte[] |
encodeRPError(SMSTPDU tpdu)
Encode this TPDU for sending as the payload of a SM-RL RP-ERROR message.
|
static byte[] |
encodeRPMOData(SMSTPDU tpdu)
Encode a TPDU for sending as the payload of a SM-RL RP-MO-DATA message.
|
static byte[] |
encodeRPMTData(SMSTPDU tpdu)
Encode a TPDU for sending as the payload of a SM-RL RP-MT-DATA message.
|
abstract byte[] |
getEncodedForm()
Encode this message to the network form.
|
abstract SMSTPDU.Type |
getType()
Return the message type of this PDU
|
checkDecode, checkModifyAndDecode, decode, encode
equals, getFieldsMap, hashCode, toString
checkModify, clone, isReadOnly, setReadOnly
public SMSTPDU()
public SMSTPDU(byte[] data)
data
- network-encoded dataNullPointerException
- if data is nullpublic SMSTPDU(byte[] data, int start, int len)
start
and is len
bytes long.
The data is not decoded and might not be decodable.data
- network-encoded datastart
- starting offset of network-encoded data in byte arraylen
- default length if not predictableNullPointerException
- if data is nullIllegalArgumentException
- if len is negativepublic void checkFieldsSet() throws EncodeException
checkFieldsSet
in class AbstractLazyEncodedDataObject<byte[]>
EncodeException
- if any mandatory field is not presentpublic abstract SMSTPDU.Type getType()
public abstract byte[] getEncodedForm() throws EncodeException
EncodeException
- if the PDU is missing mandatory fields, or provided field values are inconsistentpublic static SMSTPDU decodeRPMOData(byte[] message, int start, int len)
AbstractLazyEncodedDataObject.checkDecode()
is called.message
- a bytearray containing the encoded PDUstart
- the offset within 'message' to begin decodinglen
- the number of valid bytes after 'offset' to decode (must be at least 1)NullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if start or len are out of rangepublic static SMSTPDU decodeRPMOData(byte[] message)
decodeRPMOData(message, 0, message.length)
message
- a bytearray containing the encoded PDUNullPointerException
- if message is nullpublic static byte[] encodeRPMOData(SMSTPDU tpdu)
tpdu
- the pdu to encodeEncodeException
- if the TPDU could not be encoded for use in the RP-MO-DATA contextpublic static SMSTPDU decodeRPMTData(byte[] message, int start, int len)
AbstractLazyEncodedDataObject.checkDecode()
is called.message
- a bytearray containing the encoded PDUstart
- the offset within 'message' to begin decodinglen
- the number of valid bytes after 'offset' to decode (must be at least 1)NullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if start or len are out of rangepublic static SMSTPDU decodeRPMTData(byte[] message)
decodeRPMTData(message, 0, message.length)
message
- a bytearray containing the encoded PDUNullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if message is emptypublic static byte[] encodeRPMTData(SMSTPDU tpdu)
tpdu
- the pdu to encodeEncodeException
- if the TPDU could not be encoded for use in the RP-MT-DATA contextpublic static SMSTPDU decodeRPAck(byte[] message, int start, int len)
AbstractLazyEncodedDataObject.checkDecode()
is called.message
- a bytearray containing the encoded PDUstart
- the offset within 'message' to begin decodinglen
- the number of valid bytes after 'offset' to decode (must be at least 1)NullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if start or len are out of rangepublic static SMSTPDU decodeRPAck(byte[] message)
decodeRPAck(message, 0, message.length)
message
- a bytearray containing the encoded PDUNullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if message is emptypublic static byte[] encodeRPAck(SMSTPDU tpdu)
tpdu
- the pdu to encodeEncodeException
- if the TPDU could not be encoded for use in the RP-ACK contextpublic static SMSTPDU decodeRPError(byte[] message, int start, int len)
AbstractLazyEncodedDataObject.checkDecode()
is called.message
- a bytearray containing the encoded PDUstart
- the offset within 'message' to begin decodinglen
- the number of valid bytes after 'offset' to decode (must be at least 1)NullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if start or len are out of rangepublic static SMSTPDU decodeRPError(byte[] message)
decodeRPError(message, 0, message.length)
message
- a bytearray containing the encoded PDUNullPointerException
- if message is nullArrayIndexOutOfBoundsException
- if message is emptypublic static byte[] encodeRPError(SMSTPDU tpdu)
tpdu
- the pdu to encodeEncodeException
- if the TPDU could not be encoded for use in the RP-ERROR context