|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PacketDecoder
Utility interface for decoding packet fields.
| Method Summary | |
|---|---|
int |
getAvailableBytes()
Get the number of available bytes to be read by this decoder. |
int |
getParsePosition()
Get the current parse position of this packet decoder. |
Address |
readAddress()
Read an SMPP address from the byte array. |
byte |
readByte()
Read a byte from the byte array. |
byte[] |
readBytes(int length)
Get a byte array sub-set from the specified byte array. |
String |
readCString()
Read a C-String (a string terminated by a nul-byte) from the byte array. |
SMPPDate |
readDate()
Read an SMPP date from the byte array. |
ErrorAddress |
readErrorAddress()
Read an SMPP address and error code pairing. |
long |
readInt8()
|
String |
readString(int length)
Read a fixed-length String from the bytes. |
int |
readUInt1()
Read a 1-byte unsigned integer from the array. |
int |
readUInt2()
Read a 2-byte unsigned integer from the array. |
long |
readUInt4()
Read a 4-byte unsigned integer from the array. |
void |
setParsePosition(int parsePosition)
Set the current parse position of this decoder. |
| Method Detail |
|---|
int getParsePosition()
void setParsePosition(int parsePosition)
parsePosition - The new parse position.int getAvailableBytes()
String readCString()
bytes - The bytes to decode the string from.pos - The position to start parsing the string from. The
parse position must be updated to point to the first byte after
the terminating nul byte.
ArrayIndexOutOfBoundsException - if there are insufficient bytes
to parse the string.String readString(int length)
bytes - The bytes to decode the string from.pos - The position to start parsing the string from. The parse
position will be updated to point to the first byte after the end
of the string.length - The number of bytes to parse for the string.
ArrayIndexOutOfBoundsException - if there are insufficient bytes
to parse the string.byte readByte()
bytes - The byte array to read from.pos - The position to return the byte from. The parse position
will be incremented by 1 upon return from this method.
ArrayIndexOutOfBoundsException - if there are insufficient bytes
available.int readUInt1()
bytes - The byte array to read from.pos - The position to obtain the integer from. The parse position
will be incremented by 1 upon return from this method.
ArrayIndexOutOfBoundsException - if there are insufficient bytes
to parse the integer.int readUInt2()
bytes - The byte array to read from.pos - The position to obtain the integer from. The parse position
will be incremented by 2 upon return from this method.
ArrayIndexOutOfBoundsException - if there are insufficient bytes
to parse the integer.long readUInt4()
long primitive is required to hold
all the possible values.
bytes - The byte array to read from.pos - The position to obtain the integer from. The parse position
will be incremented by 4 upon return from this method.
ArrayIndexOutOfBoundsException - if there are insufficient bytes
to parse the integer.long readInt8()
Address readAddress()
bytes - The byte array to read the address from.pos - The position to begin parsing the address from. The parse
position will be updated to point to the first byte after the address
in the byte array.
ArrayIndexOutOfBoundsException - if there are insufficient bytes
to parse an address.ErrorAddress readErrorAddress()
SMPPDate readDate()
bytes - The byte array to read the date from.pos - The position to begin parsing the date from. The parse
position will be updated to point to the first byte after the date
in the array.
null if the date is null.byte[] readBytes(int length)
bytes - The array to extract bytes from.pos - The position to begin extracting bytes at. The parse position
will be updated to point to the next byte after the extracted byte
array.length - The number of bytes to copy out of the array.
length bytes in it copied
from bytes.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||