Package org.pcap4j.packet.factory
Interface PacketFactory<T,N extends NamedNumber<?,?>>
-
- Type Parameters:
T
- the type of object the factory method returns.N
- the type of object that is given to the factory method.
- All Known Implementing Classes:
AbstractPropertiesBasedFactory
,PropertiesBasedDnsRDataFactory
,PropertiesBasedIpV4InternetTimestampOptionDataFactory
,PropertiesBasedIpV4OptionFactory
,PropertiesBasedIpV4TosFactory
,PropertiesBasedIpV6FlowLabelFactory
,PropertiesBasedIpV6NeighborDiscoveryOptionFactory
,PropertiesBasedIpV6OptionFactory
,PropertiesBasedIpV6RoutingDataFactory
,PropertiesBasedIpV6TrafficClassFactory
,PropertiesBasedPacketFactory
,PropertiesBasedRadiotapDataFactory
,PropertiesBasedSctpChunkFactory
,PropertiesBasedTcpOptionFactory
,StaticDataLinkTypePacketFactory
,StaticDnsRDataFactory
,StaticDot11FrameTypePacketFactory
,StaticEtherTypePacketFactory
,StaticIcmpV4TypePacketFactory
,StaticIcmpV6TypePacketFactory
,StaticIpNumberPacketFactory
,StaticIpV4InternetTimestampOptionDataFactory
,StaticIpV4OptionFactory
,StaticIpV4TosFactory
,StaticIpV6FlowLabelFactory
,StaticIpV6NeighborDiscoveryOptionFactory
,StaticIpV6OptionFactory
,StaticIpV6RoutingDataFactory
,StaticIpV6TrafficClassFactory
,StaticLlcNumberPacketFactory
,StaticNotApplicablePacketFactory
,StaticPppDllProtocolPacketFactory
,StaticProtocolFamilyPacketFactory
,StaticRadiotapDataFieldFactory
,StaticSctpChunkFactory
,StaticSctpPortPacketFactory
,StaticSsh2MessageNumberPacketFactory
,StaticTcpOptionFactory
,StaticTcpPortPacketFactory
,StaticUdpPortPacketFactory
,StaticUnknownPacketFactory
public interface PacketFactory<T,N extends NamedNumber<?,?>>
An interface that provides a factory method to build a packet or a packet field.- Since:
- pcap4j 0.9.11
- Author:
- Kaito Yamada
-
-
Method Summary
Modifier and Type Method Description T
newInstance(byte[] rawData, int offset, int length, N... numbers)
A factory method to build a packet or a packet field.
-
-
-
Method Detail
-
newInstance
T newInstance(byte[] rawData, int offset, int length, N... numbers)
A factory method to build a packet or a packet field. The numbers are used as hints during the build. If no number is given, this method usually return an object which just wraps the specified part of the rawData without dissection. If one or more numbers are given, this method attempts to find a concrete class corresponding to the number for each of them in the order given. The class this method first find will be instantiated and returned. If no class is found, this method behaves in the same way as no number was given.This method doesn't throw
IllegalRawDataException
. Instead, if an IllegalRawDataException occurred during a packet dissection, this instantiatesIllegalRawDataPacket
(if T isPacket
) orIllegalRawDataHolder
(if T is notPacket
) and returns it.- Parameters:
rawData
- a byte array including data this method will use for building a T instance.offset
- offset of the data in the rawData.length
- length of the data. The object to be returned is not required to use or represent entire data. It means this length is not required to be exactly same as the returning object's length, but is required to be not smaller than it.numbers
-NamedNumber
instances this method will refer to in order to decide which concrete class to instantiate during building a T instance.- Returns:
- a new packet or packet field object.
-
-