|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.net.DatagramPacket
Untamed:
Field Summary | |
(package private) InetAddress |
address
|
(package private) byte[] |
buf
|
(package private) int |
bufLength
|
(package private) int |
length
|
(package private) int |
offset
|
(package private) int |
port
|
Constructor Summary | |
DatagramPacket(byte[] buf,
int length)
Enabled: Constructs a DatagramPacket for receiving packets of
length length . |
|
DatagramPacket(byte[] buf,
int length,
InetAddress address,
int port)
Enabled: Constructs a datagram packet for sending packets of length length to the specified port number on the specified
host. |
|
DatagramPacket(byte[] buf,
int offset,
int length)
Enabled: Constructs a DatagramPacket for receiving packets of
length length , specifying an offset into the buffer. |
|
DatagramPacket(byte[] buf,
int offset,
int length,
InetAddress address,
int port)
Enabled: Constructs a datagram packet for sending packets of length length with offset ioffset to the
specified port number on the specified host. |
|
DatagramPacket(byte[] buf,
int offset,
int length,
SocketAddress address)
Enabled: Constructs a datagram packet for sending packets of length length with offset ioffset to the
specified port number on the specified host. |
|
DatagramPacket(byte[] buf,
int length,
SocketAddress address)
Enabled: Constructs a datagram packet for sending packets of length length to the specified port number on the specified
host. |
Method Summary | |
InetAddress |
getAddress()
Enabled: Returns the IP address of the machine to which this datagram is being sent or from which the datagram was received. |
byte[] |
getData()
Enabled: Returns the data buffer. |
int |
getLength()
Enabled: Returns the length of the data to be sent or the length of the data received. |
int |
getOffset()
Enabled: Returns the offset of the data to be sent or the offset of the data received. |
int |
getPort()
Enabled: Returns the port number on the remote host to which this datagram is being sent or from which the datagram was received. |
SocketAddress |
getSocketAddress()
Enabled: Gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from. |
private static void |
init()
Perform class load-time initializations. |
void |
setAddress(InetAddress iaddr)
Enabled: Sets the IP address of the machine to which this datagram is being sent. |
void |
setData(byte[] buf)
Enabled: Set the data buffer for this packet. |
void |
setData(byte[] buf,
int offset,
int length)
Enabled: Set the data buffer for this packet. |
void |
setLength(int length)
Enabled: Set the length for this packet. |
void |
setPort(int iport)
Enabled: Sets the port number on the remote host to which this datagram is being sent. |
void |
setSocketAddress(SocketAddress address)
Enabled: Sets the SocketAddress (usually IP address + port number) of the remote host to which this datagram is being sent. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
byte[] buf
int offset
int length
int bufLength
InetAddress address
int port
Constructor Detail |
public DatagramPacket(byte[] buf, int offset, int length)
DatagramPacket
for receiving packets of
length length
, specifying an offset into the buffer.
The length
argument must be less than or equal to
buf.length
.
buf
- buffer for holding the incoming datagram.offset
- the offset for the bufferlength
- the number of bytes to read.public DatagramPacket(byte[] buf, int length)
DatagramPacket
for receiving packets of
length length
.
The length
argument must be less than or equal to
buf.length
.
buf
- buffer for holding the incoming datagram.length
- the number of bytes to read.public DatagramPacket(byte[] buf, int offset, int length, InetAddress address, int port)
length
with offset ioffset
to the
specified port number on the specified host. The
length
argument must be less than or equal to
buf.length
.
buf
- the packet data.offset
- the packet data offset.length
- the packet data length.address
- the destination address.port
- the destination port number.java.net.InetAddress
public DatagramPacket(byte[] buf, int offset, int length, SocketAddress address) throws SocketException
length
with offset ioffset
to the
specified port number on the specified host. The
length
argument must be less than or equal to
buf.length
.
buf
- the packet data.offset
- the packet data offset.length
- the packet data length.address
- the destination socket address.
IllegalArgumentException
- if address type is not supported
SocketException
java.net.InetAddress
public DatagramPacket(byte[] buf, int length, InetAddress address, int port)
length
to the specified port number on the specified
host. The length
argument must be less than or equal
to buf.length
.
buf
- the packet data.length
- the packet length.address
- the destination address.port
- the destination port number.java.net.InetAddress
public DatagramPacket(byte[] buf, int length, SocketAddress address) throws SocketException
length
to the specified port number on the specified
host. The length
argument must be less than or equal
to buf.length
.
buf
- the packet data.length
- the packet length.address
- the destination address.
IllegalArgumentException
- if address type is not supported
SocketException
java.net.InetAddress
Method Detail |
public InetAddress getAddress()
java.net.InetAddress
,
setAddress(java.net.InetAddress)
public int getPort()
setPort(int)
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, 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 datagetData()
,
getOffset()
,
getLength()
public void setAddress(InetAddress iaddr)
iaddr
- the InetAddress
getAddress()
public void setPort(int iport)
iport
- the port numbergetPort()
public void setSocketAddress(SocketAddress address)
address
- the SocketAddress
IllegalArgumentException
- if address is null or is a
SocketAddress subclass not supported by this socketgetSocketAddress()
public SocketAddress getSocketAddress()
SocketAddress
setSocketAddress(java.net.SocketAddress)
public void setData(byte[] buf)
buf
.
buf
- the buffer to set for this packet.getLength()
,
getData()
public void setLength(int length)
length
- the length to set for this packet.getLength()
,
setData(byte[], int, int)
private static void init()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |