|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ParamDescriptor
Parameter descriptor. The parameter descriptor interface provides a way for SMPP types to be read from byte arrays and written to output streams. Descriptors are used for both mandatory and optional parameters.
| Method Summary | |
|---|---|
int |
getLengthSpecifier()
Get the index of another numerical mandatory parameter which specifies the length of the parameter this descriptor represents. |
Object |
readObject(PacketDecoder decoder,
int length)
Read an object from a byte array. |
int |
sizeOf(Object obj)
Get the encoded byte-size of obj. |
void |
writeObject(Object obj,
PacketEncoder encoder)
Write the specified object to an output stream. |
| Method Detail |
|---|
int getLengthSpecifier()
As another example, take the submit_multi packet. It has a mandatory parameter called dest_address(es) which specify all the destinations the message should be submitted to. The number of destinations in the destination table is specified by the number_of_dests mandatory parameter. In this case, the descriptor used to read the dest_addresses would return the index of number_of_dests from this method.
-1 must be returned.int sizeOf(Object obj)
obj.
obj - The object to calculate the encoded size for.
#writeObject(Object, OutputStream) method.
void writeObject(Object obj,
PacketEncoder encoder)
throws IOException
obj - The object to encode.out - The output stream to write the object to.
IOException - If there was an error writing to the stream.
Object readObject(PacketDecoder decoder,
int length)
data - The byte data to read (or decode) an object from.position - The position to begin parsing from. This position will
be updated upon return to point to the first byte after the decoded
object in the byte array.length - The number of bytes to use in reading the object. If the
length is unknown and intrinsic to the type being decoded (such as
a C-String, which is terminated by a nul-byte), then -1
may be supplied.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||