パッケージ org.pcap4j.packet

クラス AbstractPacket.AbstractHeader

    • コンストラクタの詳細

      • AbstractHeader

        protected AbstractHeader()
    • メソッドの詳細

      • getRawFields

        protected abstract List<byte[]> getRawFields()
        Returns a list of byte arrays which represents this header's fields. This method is called by calcLength() and buildRawData().
        戻り値:
        a list of byte arrays which represents this header's fields
      • calcLength

        protected int calcLength()
        This method calculates the value length() will return by adding up the lengths of byte arrays in the list getRawFields() returns.
        戻り値:
        a calculated length
      • length

        public int length()
        Returns the header 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.
        定義:
        length インタフェース内 Packet.Header
        戻り値:
        the length of the byte stream of the header represented by this object in bytes
      • buildRawData

        protected byte[] buildRawData()
        This method builds the value getRawData() will return by concatenating the byte arrays in the list getRawFields() returns.
        戻り値:
        a raw data built
      • getRawData

        public byte[] getRawData()
        Returns this header'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.
        定義:
        getRawData インタフェース内 Packet.Header
        戻り値:
        the raw data of this packet's header, namely a piece of the byte stream which is actually sent through real network
      • buildHexString

        protected String buildHexString()
        This method builds the value 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)
        戻り値:
        a hex string representation of this object
      • toHexString

        public String toHexString()
        Returns the hex string representation of this object. This method calls 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.
        戻り値:
        a hex string representation of this object
      • buildString

        protected String buildString()
        This method builds the value toString() will return.
        戻り値:
        a string representation of this object
      • toString

        public String toString()
        Returns a string representation of the object. This method calls 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.
        オーバーライド:
        toString クラス内 Object
      • equals

        public boolean equals​(Object obj)
        Indicates whether some other object is "equal to" this one using return values of getRawData(). This method should be overridden so that it does more strict comparisons more efficiently.
        オーバーライド:
        equals クラス内 Object
      • calcHashCode

        protected int calcHashCode()
        This method builds the value hashCode() will return using the byte array getRawData() returns. This method may be better to be overridden for performance reason.
        戻り値:
        a calculated hash code value for the object
      • hashCode

        public int hashCode()
        Returns a hash code value for the object. This method calls 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.
        オーバーライド:
        hashCode クラス内 Object