public final class EthernetPacket extends AbstractPacket
Modifier and Type | Class and Description |
---|---|
static class |
EthernetPacket.Builder |
static class |
EthernetPacket.EthernetHeader |
AbstractPacket.AbstractBuilder, AbstractPacket.AbstractHeader
Packet.Header
Modifier and Type | Method and Description |
---|---|
protected byte[] |
buildRawData()
This method builds the value
getRawData() will return by
concatenating the header's raw data and the payload's raw data. |
protected String |
buildString()
This method builds the value
toString() will return by
concatenating the header's string representation and the payload's string representation. |
protected int |
calcHashCode()
This method calculates the value
hashCode() will return using
the header's hash code and the payload's hash code. |
protected int |
calcLength()
This method calculates the value
length() will return by
adding up the header length and the payload length. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
EthernetPacket.Builder |
getBuilder()
Returns a new Builder object populated with this object's fields' values.
|
EthernetPacket.EthernetHeader |
getHeader()
Returns the Header object representing this packet's header.
|
byte[] |
getPad() |
Packet |
getPayload()
Returns the Packet object representing this packet's payload.
|
static EthernetPacket |
newPacket(byte[] rawData,
int offset,
int length)
A static factory method.
|
buildHexString, contains, get, getOuterOf, getRawData, hashCode, iterator, length, toHexString, toString
public static EthernetPacket newPacket(byte[] rawData, int offset, int length) throws IllegalRawDataException
ByteArrays.validateBounds(byte[], int, int)
,
which may throw exceptions undocumented here.rawData
- rawDataoffset
- offsetlength
- lengthIllegalRawDataException
- if parsing the raw data fails.public EthernetPacket.EthernetHeader getHeader()
AbstractPacket
getHeader
in interface Packet
getHeader
in class AbstractPacket
public Packet getPayload()
AbstractPacket
getPayload
in interface Packet
getPayload
in class AbstractPacket
public byte[] getPad()
protected int calcLength()
AbstractPacket
length()
will return by
adding up the header length and the payload length.
If you write this subclass which represents a packet with extra parts (e.g. a trailer),
you need to override this method.calcLength
in class AbstractPacket
protected byte[] buildRawData()
AbstractPacket
getRawData()
will return by
concatenating the header's raw data and the payload's raw data.
If you write this subclass which represents a packet with extra parts (e.g. a trailer),
you need to override this method.buildRawData
in class AbstractPacket
protected String buildString()
AbstractPacket
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.buildString
in class AbstractPacket
public EthernetPacket.Builder getBuilder()
Packet
getBuilder
in interface Packet
getBuilder
in class AbstractPacket
public boolean equals(Object obj)
AbstractPacket
equals
in class AbstractPacket
protected int calcHashCode()
AbstractPacket
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.calcHashCode
in class AbstractPacket
Copyright © 2011–2016 Pcap4J.org. All rights reserved.