| java.lang.Object com.sun.tck.wma.sms.MessagePacket
All known Subclasses: com.sun.tck.wma.sms.SMSPacket, com.sun.tck.wma.cbs.CBSPacket,
MessagePacket | public class MessagePacket (Code) | | A generic message packet that treats the packet as an input or output stream
of data.
|
Constructor Summary | |
public | MessagePacket() Construct a new message packet that can be populated with some data. | public | MessagePacket(byte[] payload) Construct a new message packet that contains the given payload. |
Method Summary | |
public byte[] | getBytes(int length) Read an array of bytes from the data stream, starting at the current
index. | public byte[] | getData() Returns the contents of the packet as a byte array. | public int | getInt() Read an integer (32-bit) value from the data stream, starting at the
current index. | public long | getLong() Read a long (64-bit) value from data stream, starting at the current
index. | public short | getShort() Read a short (16-bit) value from the data stream, starting at the
current index. | public String | getString() Read a string from the data stream, starting at the current index. | public void | putBytes(byte[] buf) Write an array of bytes into the data stream, starting at the current
index. | public void | putInt(int x) Write an integer (32-bit) value into the data stream and advance the
index. | public void | putLong(long x) Write a long (64-bit) value into the data stream and advance the index. | public void | putShort(short x) Write a short (16-bit) value into the data stream and advance the
index. | public void | putString(String s) Write a string to the data stream, starting at the current index. |
MessagePacket | public MessagePacket()(Code) | | Construct a new message packet that can be populated with some data.
|
MessagePacket | public MessagePacket(byte[] payload)(Code) | | Construct a new message packet that contains the given payload.
Parameters: payload - The bytes to be read. |
getBytes | public byte[] getBytes(int length)(Code) | | Read an array of bytes from the data stream, starting at the current
index. The number of bytes to be read is specified by
length . The index is advanced by length .
Parameters: length - The number of bytes to be read. The buffer of bytes that were read. exception: ArrayIndexOutOfBoundsException - if reading goes beyond theend of the data stream. |
getData | public byte[] getData() throws IOException(Code) | | Returns the contents of the packet as a byte array.
The array of packet bytes. exception: IOException - if there was a problem while closing the streams. |
getInt | public int getInt()(Code) | | Read an integer (32-bit) value from the data stream, starting at the
current index.
The integer that was read from the data stream. exception: ArrayIndexOutOfBoundsException - if reading goes beyond theend of the data stream. |
getLong | public long getLong()(Code) | | Read a long (64-bit) value from data stream, starting at the current
index.
The long value that was read from the data stream. exception: ArrayIndexOutOfBoundsException - if reading goes beyond theend of the data stream. |
getShort | public short getShort()(Code) | | Read a short (16-bit) value from the data stream, starting at the
current index.
The short that was read from the data stream. exception: ArrayIndexOutOfBoundsException - if reading goes beyond theend of the data stream. |
getString | public String getString()(Code) | | Read a string from the data stream, starting at the current index. The
string is assumed to be terminated by a null character.
The string of characters, converted to ajava.lang.String object. exception: ArrayIndexOutOfBoundsException - if reading goes beyond theend of the data stream. |
putBytes | public void putBytes(byte[] buf) throws IOException(Code) | | Write an array of bytes into the data stream, starting at the current
index.
Parameters: buf - The buffer of bytes to be written into the data stream. exception: ArrayIndexOutOfBoundsException - if reading goes beyond theend of the data stream. |
putInt | public void putInt(int x) throws IOException(Code) | | Write an integer (32-bit) value into the data stream and advance the
index.
Parameters: x - The integer to be written. exception: ArrayIndexOutOfBoundsException - if reading goes beyond theend of the data stream. |
putLong | public void putLong(long x) throws IOException(Code) | | Write a long (64-bit) value into the data stream and advance the index.
Parameters: x - The long to be written. exception: ArrayIndexOutOfBoundsException - if reading goes beyond theend of the data stream. |
putShort | public void putShort(short x) throws IOException(Code) | | Write a short (16-bit) value into the data stream and advance the
index.
Parameters: x - The short to be written. exception: ArrayIndexOutOfBoundsException - if reading goes beyond theend of the data stream. |
putString | public void putString(String s) throws IOException(Code) | | Write a string to the data stream, starting at the current index. The
characters in the string are written, followed by a null-character
terminator.
Parameters: s - The string to be written. exception: ArrayIndexOutOfBoundsException - if reading goes beyond theend of the data stream. |
|
|