public abstract static class AbstractPacket.AbstractHeader extends Object implements Packet.Header
Modifier | Constructor and Description |
---|---|
protected |
AbstractPacket.AbstractHeader() |
Modifier and Type | Method and Description |
---|---|
protected String |
buildHexString()
This method builds the value
toHexString() will return using the return
value of getRawData() . |
protected byte[] |
buildRawData()
This method builds the value
getRawData() will return by concatenating
the byte arrays in the list getRawFields() returns. |
protected String |
buildString()
This method builds the value
toString() will return. |
protected int |
calcHashCode()
This method builds the value
hashCode() will return using the byte array
getRawData() returns. |
protected int |
calcLength()
This method calculates the value
length() will return by adding up the
lengths of byte arrays in the list getRawFields() returns. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one using return values of
getRawData() . |
byte[] |
getRawData()
Returns this header's raw data.
|
protected abstract List<byte[]> |
getRawFields()
Returns a list of byte arrays which represents this header's fields.
|
int |
hashCode()
Returns a hash code value for the object.
|
int |
length()
Returns the header length in bytes.
|
String |
toHexString()
Returns the hex string representation of this object.
|
String |
toString()
Returns a string representation of the object.
|
protected abstract List<byte[]> getRawFields()
calcLength()
and buildRawData()
.protected int calcLength()
length()
will return by adding up the
lengths of byte arrays in the list getRawFields()
returns.public int length()
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.length
in interface Packet.Header
protected byte[] buildRawData()
getRawData()
will return by concatenating
the byte arrays in the list getRawFields()
returns.public byte[] getRawData()
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.getRawData
in interface Packet.Header
protected String buildHexString()
toHexString()
will return using the return
value of getRawData()
. Each octet in this return value is separated by a
white space. (e.g. 00 01 02 03 aa bb cc)public String toHexString()
buildHexString()
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.protected String buildString()
toString()
will return.public String toString()
buildString()
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.public boolean equals(Object obj)
getRawData()
. This method should be overridden so that it does more strict
comparisons more efficiently.protected int calcHashCode()
hashCode()
will return using the byte array
getRawData()
returns. This method may be better to be overridden for
performance reason.public int hashCode()
calcHashCode()
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.Copyright © 2011–2019 Pcap4J.org. All rights reserved.