public interface Packet extends Iterable<Packet>, Serializable
PropertiesBasedPacketFactory
,
classes which imprement this interface must implement the following method:
public static Packet newPacket(byte[] rawData, int offset, int length)
throws IllegalRawDataException
Modifier and Type | Interface and Description |
---|---|
static interface |
Packet.Builder
This interface is designed to be implemented by builder classes for packet objects.
|
static interface |
Packet.Header
The interface representing a packet's header.
|
Modifier and Type | Method and Description |
---|---|
<T extends Packet> |
contains(Class<T> clazz)
Returns true if this packet is or its payload includes an object of
specified packet class; false otherwise.
|
<T extends Packet> |
get(Class<T> clazz)
Traverses this packet and its payload to find an object of
the specified packet class and returns the object.
|
Packet.Builder |
getBuilder()
Returns a new Builder object populated with this object's fields' values.
|
Packet.Header |
getHeader()
Returns the Header object representing this packet's header.
|
Packet |
getOuterOf(Class<? extends Packet> clazz)
Returns the outer packet object of
a packet object
get(clazz) returns. |
Packet |
getPayload()
Returns the Packet object representing this packet's payload.
|
byte[] |
getRawData()
Returns this packet's raw data.
|
int |
length()
Returns the packet length in bytes.
|
Packet.Header getHeader()
Packet getPayload()
int length()
byte[] getRawData()
<T extends Packet> T get(Class<T> clazz)
T
- packetclazz
- the packet class of the object to getPacket getOuterOf(Class<? extends Packet> clazz)
get(clazz)
returns.clazz
- the packet class of the object
whose outer packet object is what you want to get<T extends Packet> boolean contains(Class<T> clazz)
T
- packetclazz
- the packet class of the object to search forPacket.Builder getBuilder()
Copyright © 2011–2016 Pcap4J.org. All rights reserved.