|
J2ME Foundation | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the generic datagram interface. It represents an object that will act as the holder of data to be send or received from a datagram connection. The DataInput and DataOutput interfaces are extended by this interface to provide a simple way to read and write binary data in and out of the datagram buffer. A special function reset() may be called to reset the read/write point to the beginning of the buffer.
Method Summary | |
String |
getAddress()
Get the address in the datagram |
byte[] |
getData()
Get the buffer |
int |
getLength()
Get the length |
int |
getOffset()
Get the offset |
void |
reset()
Reset the read/write pointer and zeros the offset and length parameters. |
void |
setAddress(Datagram reference)
Set datagram address, copying the address from another datagram. |
void |
setAddress(String addr)
Set datagram address. |
void |
setData(byte[] buffer,
int offset,
int len)
Set the buffer, offset and length |
void |
setLength(int len)
Set the length |
Methods inherited from interface java.io.DataInput |
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes |
Methods inherited from interface java.io.DataOutput |
write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
Method Detail |
public String getAddress()
public byte[] getData()
public int getLength()
public int getOffset()
public void setAddress(String addr) throws IOException
{protocol}:{target}E.g. The "target" can be "//{host}:{port}" (but is not necessarily limited to this.)
datagram://123.456.789.12:1234Note that if the address of a datagram is not specified, then it defaults to that of the connection.
addr
- the new target address as a URLIllegalArgumentException
- if the address is not validpublic void setAddress(Datagram reference)
reference
- the datagram who's address will be copied as
the new target address for this datagram.IllegalArgumentException
- if the address is not validpublic void setLength(int len)
len
- the new length of the dataIllegalArgumentException
- if the length is negative or larger than the bufferpublic void setData(byte[] buffer, int offset, int len)
addr
- the data bufferoffset
- the offset into the data bufferlen
- the length of the data in the bufferIllegalArgumentException
- if the length or offset fall outside the bufferpublic void reset()
|
J2ME Foundation | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |