SourceForge Jpcap

net.sourceforge.jpcap.net
Class PacketEncoding

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

public class PacketEncoding
extends Object

Packet encoding.

Contains utility methods for decoding generic packets.

Version:
$Revision: 1.1 $
Author:
Patrick Charles and Jonas Lehmann
Last modified by:
$Author: esmondpitt $
Last modified at:
$Date: 2008/08/21 02:58:28 $

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.
dataLength - Maximum size of data to copy
Returns:
the extracted packet data.

Copyright © Patrick Charles & Jonas Lehmann, 2001; Esmond Pitt, 2008.