Class IllegalPacket

java.lang.Object
org.pcap4j.packet.AbstractPacket
org.pcap4j.packet.IllegalPacket
All Implemented Interfaces:
Serializable, Iterable<Packet>, Packet

public final class IllegalPacket extends AbstractPacket
Since:
pcap4j 0.9.5
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • rawData

      private final byte[] rawData
  • Constructor Details

    • IllegalPacket

      private IllegalPacket(byte[] rawData, int offset, int length)
    • IllegalPacket

      private IllegalPacket(IllegalPacket.Builder builder)
  • Method Details

    • newPacket

      public static IllegalPacket newPacket(byte[] rawData, int offset, int length)
      A static factory method. This method validates the arguments by ByteArrays.validateBounds(byte[], int, int), which may throw exceptions undocumented here.
      Parameters:
      rawData - rawData
      offset - offset
      length - length
      Returns:
      a new IllegalPacket object.
    • length

      public int length()
      Description copied from class: AbstractPacket
      Returns the packet length in bytes. This method calls calcLength() 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:
      length in interface Packet
      Overrides:
      length in class AbstractPacket
      Returns:
      the length of the byte stream of the packet represented by this object in bytes
    • getRawData

      public byte[] getRawData()
      Description copied from class: AbstractPacket
      Returns this packet's raw data. This method calls buildRawData() 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:
      getRawData in interface Packet
      Overrides:
      getRawData in class AbstractPacket
      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: Packet
      Returns a new Builder object populated with this object's fields' values.
      Specified by:
      getBuilder in interface Packet
      Specified by:
      getBuilder in class AbstractPacket
      Returns:
      a new Builder object populated with this object's fields values
    • buildString

      protected String buildString()
      Description copied from class: AbstractPacket
      This method builds the value toString() 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:
      buildString in class AbstractPacket
      Returns:
      a string representation of this object
    • equals

      public boolean equals(Object obj)
      Description copied from class: AbstractPacket
      Indicates 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:
      equals in class AbstractPacket
    • calcHashCode

      protected int calcHashCode()
      Description copied from class: AbstractPacket
      This method calculates the value hashCode() 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:
      calcHashCode in class AbstractPacket
      Returns:
      a calculated hash code value for the object