|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--java.net.RawPacket
This class represents a raw packet.
Raw packets are used to implement a connectionless raw packet delivery service. Each message is routed from one machine to another based solely on information contained within that packet. Multiple packets sent from one machine to another might be routed differently, and might arrive in any order.
| Constructor Summary | |
RawPacket(byte[] buf,
int length)
Constructs a RawPacket for receiving packets of
length ilength. |
|
RawPacket(byte[] buf,
int length,
InetAddress address)
Constructs a raw packet for sending packets of length ilength on the specified
host. |
|
RawPacket(byte[] buf,
int offset,
int length)
Constructs a RawPacket for receiving packets of
length ilength. |
|
RawPacket(byte[] buf,
int offset,
int length,
InetAddress address)
Constructs a raw packet for sending packets of length ilength on the specified
host. |
|
| Method Summary | |
InetAddress |
getAddress()
Returns the IP address of the machine to which this packet is being sent or from which the packet was received. |
byte[] |
getData()
Returns the data received or the data to be sent. |
int |
getLength()
Returns the length of the data to be sent or the length of the data received. |
int |
getOffset()
Returns the current position of the offset |
void |
setAddress(InetAddress iaddr)
|
void |
setData(byte[] buf)
Set the data in the packet |
void |
setData(byte[] buf,
int offset,
int length)
Insert data of size length<\code> at offset |
void |
setLength(int length)
Set the length for this packet. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public RawPacket(byte[] buf,
int length)
RawPacket for receiving packets of
length ilength.
The length argument must be less than or equal to
ibuf.length.
buf - buffer for holding the incoming datagram.length - the number of bytes to read.
public RawPacket(byte[] buf,
int offset,
int length)
RawPacket for receiving packets of
length ilength.buf - buffer for holding the incoming datagram.offset - offset to put the data at.length - the number of bytes to read.
public RawPacket(byte[] buf,
int offset,
int length,
InetAddress address)
ilength on the specified
host.buf - the packet data.length - the packet length.offset - offset to put the data at.addres - the destination address.InetAddress
public RawPacket(byte[] buf,
int length,
InetAddress address)
ilength on the specified
host.buf - the packet data.length - the packet length.addres - the destination address.InetAddress| Method Detail |
public InetAddress getAddress()
InetAddresspublic byte[] getData()
public int getOffset()
public int getLength()
public void setData(byte[] buf,
int offset,
int length)
length<\code> at offset offset<\code>.
- Parameters:
buf - the data to insertoffset - the offset to put the data atlength - the length of the data to insert
public void setAddress(InetAddress iaddr)
public void setData(byte[] buf)
buf - the data to put in the packetpublic 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[], int, int)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||