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