|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A datagram packet interface. Needed because of the stupid way java.net assumes SocketAddress instances are going to be InetSocketAddresses!
| Method Summary | |
byte[] |
getData()
Returns the data buffer. |
int |
getLength()
Returns the length of the data to be sent or the length of the data received. |
int |
getOffset()
Returns the offset of the data to be sent or the offset of the data received. |
java.net.SocketAddress |
getSocketAddress()
Gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from. |
void |
setData(byte[] buf)
Set the data buffer for this packet. |
void |
setData(byte[] buf,
int offset,
int length)
Set the data buffer for this packet. |
void |
setLength(int length)
Set the length for this packet. |
void |
setSocketAddress(java.net.SocketAddress address)
Sets the SocketAddress (usually IP address + port number) of the remote host to which this datagram is being sent. |
| Method Detail |
public byte[] getData()
offset in the buffer,
and runs for length long.
setData(byte[], int, int)public int getOffset()
public int getLength()
setLength(int)public void setData(byte[] buf)
buf.
buf - the buffer to set for this packet.
java.lang.NullPointerException - if the argument is null.getLength(),
getData()
public void setData(byte[] buf,
int offset,
int length)
buf - the buffer to set for this packetoffset - the offset into the datalength - the length of the data
and/or the length of the buffer used to receive data
java.lang.NullPointerException - if the argument is nullgetData(),
getOffset(),
getLength()public void setLength(int length)
length - the length to set for this packet.
java.lang.IllegalArgumentException - if the length is negative
of if the length is greater than the packet's data buffer
length.getLength(),
setData(byte[])public java.net.SocketAddress getSocketAddress()
SocketAddresssetSocketAddress(java.net.SocketAddress)public void setSocketAddress(java.net.SocketAddress address)
address - the SocketAddress
java.lang.IllegalArgumentException - if address is null or is a
SocketAddress subclass not supported by this socketgetSocketAddress()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||