public interface Packet extends java.lang.Iterable<Packet>, java.io.Serializable
PropertiesBasedPacketFactory,
classes which implement 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 |
|---|---|
default <T extends Packet> |
contains(java.lang.Class<T> clazz)
Returns true if this packet is or its payload includes an object of
specified packet class; false otherwise.
|
default <T extends Packet> |
get(java.lang.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.
|
default Packet |
getOuterOf(java.lang.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.
|
default java.util.Iterator<Packet> |
iterator() |
int |
length()
Returns the packet length in bytes.
|
Packet.Header getHeader()
Packet getPayload()
int length()
byte[] getRawData()
default java.util.Iterator<Packet> iterator()
iterator in interface java.lang.Iterable<Packet>default <T extends Packet> T get(java.lang.Class<T> clazz)
T - packetclazz - the packet class of the object to getdefault Packet getOuterOf(java.lang.Class<? extends Packet> clazz)
get(clazz) returns.clazz - the packet class of the object
whose outer packet object is what you want to getdefault <T extends Packet> boolean contains(java.lang.Class<T> clazz)
T - packetclazz - the packet class of the object to search forPacket.Builder getBuilder()
Copyright © 2011 - 2018 Pcap4J.org. All rights reserved.