public abstract class ByteData
extends java.lang.Object
Utility methods for PDUs and other PDU-related types (addresses, TLVs etc).
Constructor and Description |
---|
ByteData() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkCString(java.lang.String s,
int max) |
protected void |
checkCString(java.lang.String s,
int min,
int max) |
protected void |
checkDate(java.lang.String date) |
protected int |
decodeUnsigned(byte b) |
protected byte |
encodeUnsigned(int i) |
static boolean |
equalCStrings(java.lang.String s1,
java.lang.String s2)
Compares the two given C string for equality.
|
abstract void |
fromBuffer(java.nio.ByteBuffer buf)
Read byte data from buffer
|
static java.lang.String |
getCString(byte[] bytes) |
static java.lang.String |
getCString(java.nio.ByteBuffer buf) |
static byte[] |
getCStringByteArray(java.lang.String s) |
static int |
getCStringHashCode(java.lang.String s)
Returns a hash code value for the given C string.
|
static boolean |
isNullOrEmptyCString(java.lang.String s) |
static java.lang.String |
printAsHex(byte[] bytes) |
static void |
putCString(java.nio.ByteBuffer buf,
java.lang.String s) |
abstract int |
size()
Get the number of bytes that this object contains
|
abstract void |
toBuffer(java.nio.ByteBuffer buf)
Write this byte data object to buffer
|
protected int decodeUnsigned(byte b)
protected byte encodeUnsigned(int i)
protected void checkDate(java.lang.String date) throws SmppDateFormatException
SmppDateFormatException
protected void checkCString(java.lang.String s, int max) throws SmppStringLengthException
SmppStringLengthException
protected void checkCString(java.lang.String s, int min, int max) throws SmppStringLengthException
SmppStringLengthException
public static void putCString(java.nio.ByteBuffer buf, java.lang.String s) throws java.nio.BufferOverflowException
java.nio.BufferOverflowException
public static java.lang.String getCString(java.nio.ByteBuffer buf) throws java.nio.BufferUnderflowException
java.nio.BufferUnderflowException
public static java.lang.String getCString(byte[] bytes)
public static byte[] getCStringByteArray(java.lang.String s)
public static boolean equalCStrings(java.lang.String s1, java.lang.String s2)
Compares the two given C string for equality.
public static int getCStringHashCode(java.lang.String s)
Returns a hash code value for the given C string.
public static boolean isNullOrEmptyCString(java.lang.String s)
public static java.lang.String printAsHex(byte[] bytes)
public abstract void toBuffer(java.nio.ByteBuffer buf) throws java.nio.BufferOverflowException
Write this byte data object to buffer
java.nio.BufferOverflowException
public abstract void fromBuffer(java.nio.ByteBuffer buf) throws java.nio.BufferUnderflowException, InvalidPDUFieldException
Read byte data from buffer
java.nio.BufferUnderflowException
InvalidPDUFieldException
public abstract int size()
Get the number of bytes that this object contains