Class PropertiesBasedPacketFactory
java.lang.Object
org.pcap4j.packet.factory.propertiesbased.PropertiesBasedPacketFactory
- All Implemented Interfaces:
PacketFactory<Packet, NamedNumber<?,?>>
public final class PropertiesBasedPacketFactory
extends Object
implements PacketFactory<Packet, NamedNumber<?,?>>
- Since:
- pcap4j 0.9.14
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PropertiesBasedPacketFactorygetTargetClass(NamedNumber<?, ?> number) newInstance(byte[] rawData, int offset, int length) newInstance(byte[] rawData, int offset, int length, Class<? extends Packet> packetClass) newInstance(byte[] rawData, int offset, int length, NamedNumber<?, ?> number)
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
PropertiesBasedPacketFactory
private PropertiesBasedPacketFactory()
-
-
Method Details
-
getInstance
- Returns:
- the singleton instance of PropertiesBasedPacketFactory.
-
newInstance
- Specified by:
newInstancein interfacePacketFactory<Packet, NamedNumber<?,?>> - Parameters:
rawData- rawDataoffset- offsetlength- lengthnumber- number- Returns:
- a new data object.
-
newInstance
- Specified by:
newInstancein interfacePacketFactory<Packet, NamedNumber<?,?>> - Parameters:
rawData- rawDataoffset- offsetlength- length- Returns:
- a new data object.
-
newInstance
public Packet newInstance(byte[] rawData, int offset, int length, Class<? extends Packet> packetClass) - Parameters:
rawData- rawDataoffset- offsetlength- lengthpacketClass- packetClass- Returns:
- a new Packet object.
- Throws:
IllegalStateException- if an access to the newInstance method of the packetClass fails.IllegalArgumentException- if an exception other thanIllegalRawDataExceptionis thrown by newInstance method of the packetClass.NullPointerException- if any of arguments are null.
-
getTargetClass
- Specified by:
getTargetClassin interfacePacketFactory<Packet, NamedNumber<?,?>> - Parameters:
number- number- Returns:
- a
Classobject this factory instantiates byPacketFactory.newInstance(byte[], int, int, NamedNumber)with the number argument.
-
getTargetClass
- Specified by:
getTargetClassin interfacePacketFactory<Packet, NamedNumber<?,?>> - Returns:
- a
Classobject this factory instantiates byPacketFactory.newInstance(byte[], int, int).
-