net.sourceforge.jpcap.net
Class PacketEncoding

java.lang.Object
  extended bynet.sourceforge.jpcap.net.PacketEncoding

public class PacketEncoding
extends java.lang.Object

Packet encoding.

Contains utility methods for decoding generic packets.


Constructor Summary
PacketEncoding()
           
 
Method Summary
static byte[] extractData(int offset, int headerLen, byte[] bytes)
          Extract data from a packet.
static byte[] extractData(int offset, int headerLen, byte[] bytes, int dataLength)
          Extract data from a packet.
static byte[] extractHeader(int offset, int headerLen, byte[] bytes)
          Extract a header from a packet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PacketEncoding

public PacketEncoding()
Method Detail

extractHeader

public static byte[] extractHeader(int offset,
                                   int headerLen,
                                   byte[] bytes)
Extract a header from a packet.

Parameters:
offset - the offset in bytes to the start of the embedded header.
headerLen - the length of the header embedded in the packet.
bytes - the packet data, including the embedded header and data.
Returns:
the extracted header data.

extractData

public static byte[] extractData(int offset,
                                 int headerLen,
                                 byte[] bytes)
Extract data from a packet.

Parameters:
offset - the offset in bytes to the start of the embedded header.
headerLen - the length of the header embedded in the packet.
bytes - the packet data, including the embedded header and data.
Returns:
the extracted packet data.

extractData

public static byte[] extractData(int offset,
                                 int headerLen,
                                 byte[] bytes,
                                 int dataLength)
Extract data from a packet.

Parameters:
offset - the offset in bytes to the start of the embedded header.
headerLen - the length of the header embedded in the packet.
bytes - the packet data, including the embedded header and data.
Returns:
the extracted packet data.