rtpi.transport
Class TransportPacket

java.lang.Object
  |
  +--rtpi.transport.TransportPacket

public class TransportPacket
extends java.lang.Object

This is an abstraction of a transport layer packet.


Constructor Summary
TransportPacket(int l, byte[] d)
          This constructer is used to construct a packet that should be send over the net.
TransportPacket(int l, byte[] d, java.net.InetAddress add, int p)
          This constuctor is used by a transport instance, to encapsulate a data received from the net.
 
Method Summary
 byte[] getData()
          Get the data included in this packet.
 int getLength()
          This returns the length of the data (in Bytes) that is included in this packet.
 java.net.InetAddress getSenderAddress()
          Get the address of the sender.
 int getSenderPort()
          Get the port of the sender.
 void setLength(int len)
          This sets the length of the data (in Bytes) that is included in this packet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransportPacket

public TransportPacket(int l,
                       byte[] d,
                       java.net.InetAddress add,
                       int p)
This constuctor is used by a transport instance, to encapsulate a data received from the net.
Parameters:
l - Length of the data contained in the packet.
d - Data contained in the packet. Note that d.length might be larger than the number of bytes received from the net.
add - The address of the sender.
p - The port of the sender.

TransportPacket

public TransportPacket(int l,
                       byte[] d)
This constructer is used to construct a packet that should be send over the net.
Parameters:
l - Length of the data contained in the packet.
d - Data contained in the packet. Note that d.length might be larger than the number of bytes received from the net.
Method Detail

getLength

public int getLength()
This returns the length of the data (in Bytes) that is included in this packet.
Returns:
The length of the data.

setLength

public void setLength(int len)
This sets the length of the data (in Bytes) that is included in this packet. Note that the length must be smaller than the length of the data array.
Parameters:
len - The length of the data.

getData

public byte[] getData()
Get the data included in this packet.
Returns:
The data.

getSenderPort

public int getSenderPort()
Get the port of the sender.
Returns:
The sender port.

getSenderAddress

public java.net.InetAddress getSenderAddress()
Get the address of the sender.
Returns:
The sender network address.