- java.lang.Object
-
- org.pcap4j.packet.AbstractPacket
-
- org.pcap4j.packet.IllegalPacket
-
public final class IllegalPacket extends AbstractPacket
- Since:
- pcap4j 0.9.5
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIllegalPacket.Builder-
Nested classes/interfaces inherited from class org.pcap4j.packet.AbstractPacket
AbstractPacket.AbstractBuilder, AbstractPacket.AbstractHeader
-
Nested classes/interfaces inherited from interface org.pcap4j.packet.Packet
Packet.Header
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]rawDataprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description privateIllegalPacket(byte[] rawData, int offset, int length)privateIllegalPacket(IllegalPacket.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringbuildString()This method builds the valuetoString()will return by concatenating the header's string representation and the payload's string representation.protected intcalcHashCode()This method calculates the valuehashCode()will return using the header's hash code and the payload's hash code.booleanequals(java.lang.Object obj)Indicates whether some other object is "equal to" this one.IllegalPacket.BuildergetBuilder()Returns a new Builder object populated with this object's fields' values.byte[]getRawData()Returns this packet's raw data.intlength()Returns the packet length in bytes.static IllegalPacketnewPacket(byte[] rawData, int offset, int length)A static factory method.-
Methods inherited from class org.pcap4j.packet.AbstractPacket
buildHexString, buildRawData, calcLength, contains, get, getHeader, getOuterOf, getPayload, hashCode, iterator, toHexString, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
rawData
private final byte[] rawData
-
-
Constructor Detail
-
IllegalPacket
private IllegalPacket(byte[] rawData, int offset, int length)
-
IllegalPacket
private IllegalPacket(IllegalPacket.Builder builder)
-
-
Method Detail
-
newPacket
public static IllegalPacket newPacket(byte[] rawData, int offset, int length)
A static factory method. This method validates the arguments byByteArrays.validateBounds(byte[], int, int), which may throw exceptions undocumented here.- Parameters:
rawData- rawDataoffset- offsetlength- length- Returns:
- a new IllegalPacket object.
-
length
public int length()
Description copied from class:AbstractPacketReturns the packet length in bytes. This method callscalcLength()and caches the return value when it is called for the first time, and then, this method returns the cached value from the second time.- Specified by:
lengthin interfacePacket- Overrides:
lengthin classAbstractPacket- Returns:
- the length of the byte stream of the packet represented by this object in bytes
-
getRawData
public byte[] getRawData()
Description copied from class:AbstractPacketReturns this packet's raw data. This method callsbuildRawData()and caches the return value when it is called for the first time, and then, this method returns the cached value from the second time. More correctly, this method returns a copy of the cached value, so that the cache can't be changed.- Specified by:
getRawDatain interfacePacket- Overrides:
getRawDatain classAbstractPacket- Returns:
- this packet's raw data, namely the byte stream which is actually sent through real network
-
getBuilder
public IllegalPacket.Builder getBuilder()
Description copied from interface:PacketReturns a new Builder object populated with this object's fields' values.- Specified by:
getBuilderin interfacePacket- Specified by:
getBuilderin classAbstractPacket- Returns:
- a new Builder object populated with this object's fields values
-
buildString
protected java.lang.String buildString()
Description copied from class:AbstractPacketThis method builds the valuetoString()will return by concatenating the header's string representation and the payload's string representation. If you write this subclass which represents a packet with extra parts (e.g. a trailer), you need to override this method.- Overrides:
buildStringin classAbstractPacket- Returns:
- a string representation of this object
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:AbstractPacketIndicates whether some other object is "equal to" this one. This method firstly compares this packet's header using the header's equals(Object) method, then compares this packet's payload using the payload's equals(Object) method. If you write this subclass with fields which represent somethings other than header or payload, you need to override this method.- Overrides:
equalsin classAbstractPacket
-
calcHashCode
protected int calcHashCode()
Description copied from class:AbstractPacketThis method calculates the valuehashCode()will return using the header's hash code and the payload's hash code. If you write this subclass which represents a packet with extra parts (e.g. a trailer), you need to override this method.- Overrides:
calcHashCodein classAbstractPacket- Returns:
- a calculated hash code value for the object
-
-