public final class DatagramPacket extends Object
Constructor and Description |
---|
DatagramPacket(byte[] buf,
int length)
Constructs a DatagramPacket useable to revieve ...
|
DatagramPacket(byte[] buf,
int length,
InetAddress address,
int port)
Constructs a DatagramPacket to send datagrams ...
|
DatagramPacket(byte[] buf,
int offset,
int length)
Constructs a DatagramPacket useable to revieve ...
|
DatagramPacket(byte[] buf,
int offset,
int length,
InetAddress address,
int port)
Constructs a DatagramPacket to send datagrams ...
|
DatagramPacket(byte[] buf,
int offset,
int length,
SocketAddress address) |
DatagramPacket(byte[] bytes,
int length,
SocketAddress address) |
Modifier and Type | Method and Description |
---|---|
InetAddress |
getAddress()
returns the address from the remote host
|
byte[] |
getData()
getData() returns the data received or the data to be sent.
|
int |
getLength()
getLength() retrieves the length of the data in the buffer returned
by getData().
|
int |
getOffset()
getOffset() retrieves the offset where the data begins in the buffer
returned by getData().
|
int |
getPort()
returns the address from the remote host
|
SocketAddress |
getSocketAddress() |
void |
setAddress(InetAddress iaddr)
setAddress(InetAddress iaddr) sets the remote address of this packet.
|
void |
setData(byte[] buf)
setData(byte[] buf) assigns a new buffer to the packet.
|
void |
setData(byte[] buf,
int off,
int len)
setData(byte[] buf, int offset, int length) assigns a new buffer,
offset, and length to the packet.
|
void |
setLength(int length)
setLength(int length) sets the length for this packet.
|
void |
setPort(int port)
setPort(int port) sets the remote port of this packet.
|
void |
setSocketAddress(SocketAddress address) |
public DatagramPacket(byte[] buf, int offset, int length) throws IllegalArgumentException
IllegalArgumentException
public DatagramPacket(byte[] buf, int length) throws IllegalArgumentException
IllegalArgumentException
public DatagramPacket(byte[] buf, int offset, int length, InetAddress address, int port) throws IllegalArgumentException
IllegalArgumentException
public DatagramPacket(byte[] buf, int length, InetAddress address, int port) throws IllegalArgumentException
IllegalArgumentException
public DatagramPacket(byte[] bytes, int length, SocketAddress address) throws SocketException
SocketException
public DatagramPacket(byte[] buf, int offset, int length, SocketAddress address) throws SocketException
SocketException
public void setSocketAddress(SocketAddress address)
public InetAddress getAddress()
public int getPort()
public byte[] getData()
public int getOffset()
public int getLength()
public void setAddress(InetAddress iaddr)
public void setPort(int port)
public void setData(byte[] buf)
public SocketAddress getSocketAddress()
public void setData(byte[] buf, int off, int len)
public void setLength(int length) throws IllegalArgumentException
IllegalArgumentException