public class ShortMessage extends ByteData
Encapsulates the short message data and the sm_length field that precedes it in a PDU.
Constructor and Description |
---|
ShortMessage() |
ShortMessage(byte[] message)
Creates a short message using a byte array for the short message data.
|
ShortMessage(java.lang.String message,
java.lang.String charset)
Creates a short message using a string for the short message data.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
static boolean |
equals(ShortMessage message1,
ShortMessage message2)
Compares the two short messages for equality.
|
void |
fromBuffer(java.nio.ByteBuffer buf)
Read byte data from buffer
|
byte[] |
getMessage()
Gets the short message data as a byte array.
|
java.lang.String |
getMessageText(java.lang.String charset)
Gets the short message data as a string, decoded using the specified character set.
|
int |
getSmLength() |
int |
hashCode() |
static int |
hashCode(ShortMessage message)
Returns a hash code value for the given short message.
|
void |
setMessage(byte[] message)
Set the short message data using a byte array
|
void |
setMessageText(java.lang.String message,
java.lang.String charset)
Set the short message data using a string, encoded using the named character set.
|
int |
size()
Get the number of bytes that this object contains
|
void |
toBuffer(java.nio.ByteBuffer buf)
Write this byte data object to buffer
|
java.lang.String |
toString() |
checkCString, checkCString, checkDate, decodeUnsigned, encodeUnsigned, equalCStrings, getCString, getCString, getCStringByteArray, getCStringHashCode, isNullOrEmptyCString, printAsHex, putCString
public ShortMessage()
public ShortMessage(byte[] message)
Creates a short message using a byte array for the short message data.
public ShortMessage(java.lang.String message, java.lang.String charset) throws java.io.UnsupportedEncodingException
Creates a short message using a string for the short message data. The string will be encoded to a byte array using the specified character set.
java.io.UnsupportedEncodingException
- if the named character set is not supported.public int getSmLength()
public void setMessage(byte[] message)
Set the short message data using a byte array
public void setMessageText(java.lang.String message, java.lang.String charset) throws java.io.UnsupportedEncodingException
Set the short message data using a string, encoded using the named character set.
java.io.UnsupportedEncodingException
- if the named character set is not supported.public byte[] getMessage()
Gets the short message data as a byte array.
public java.lang.String getMessageText(java.lang.String charset) throws java.io.UnsupportedEncodingException
Gets the short message data as a string, decoded using the specified character set.
charset
- java.io.UnsupportedEncodingException
- if the named character set is not supported.public void toBuffer(java.nio.ByteBuffer buf) throws java.nio.BufferOverflowException
ByteData
Write this byte data object to buffer
public void fromBuffer(java.nio.ByteBuffer buf) throws java.nio.BufferUnderflowException, InvalidPDUFieldException
ByteData
Read byte data from buffer
fromBuffer
in class ByteData
java.nio.BufferUnderflowException
InvalidPDUFieldException
public int size()
ByteData
Get the number of bytes that this object contains
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static boolean equals(ShortMessage message1, ShortMessage message2)
Compares the two short messages for equality.
public static int hashCode(ShortMessage message)
Returns a hash code value for the given short message.