Class ShortTunnelBuildMessage

All Implemented Interfaces:
I2NPMessage

public class ShortTunnelBuildMessage extends TunnelBuildMessage
Variable size, small records. Preliminary, see proposal 157.
Since:
0.9.49
  • Field Details

  • Constructor Details

    • ShortTunnelBuildMessage

      public ShortTunnelBuildMessage(I2PAppContext context)
      zero record count, will be set with readMessage()
    • ShortTunnelBuildMessage

      public ShortTunnelBuildMessage(I2PAppContext context, int records)
  • Method Details

    • setRecord

      public void setRecord(int index, EncryptedBuildRecord record)
      Overrides:
      setRecord in class TunnelBuildMessageBase
      Parameters:
      record - must be ShortEncryptedBuildRecord or null
    • calculateWrittenLength

      protected int calculateWrittenLength()
      Description copied from class: I2NPMessageImpl
      calculate the message body's length (not including the header and footer
      Overrides:
      calculateWrittenLength in class TunnelBuildMessageBase
    • getType

      public int getType()
      Description copied from interface: I2NPMessage
      Return the unique identifier for this type of I2NP message, as defined in the I2NP spec
      Specified by:
      getType in interface I2NPMessage
      Overrides:
      getType in class TunnelBuildMessage
    • readMessage

      public void readMessage(byte[] data, int offset, int dataSize, int type) throws I2NPMessageException
      Description copied from interface: I2NPMessage
      Read the body into the data structures, after the initial type byte and the uniqueId / expiration, using the current class's format as defined by the I2NP specification Implementations must not read more than dataSize, or throw I2NPMessageException or IndexOutOfBoundsException if they do.
      Specified by:
      readMessage in interface I2NPMessage
      Overrides:
      readMessage in class TunnelBuildMessageBase
      Parameters:
      data - data to read from
      offset - where to start in the data array
      dataSize - how long into the data to read
      type - I2NP message type
      Throws:
      I2NPMessageException - if the stream doesn't contain a valid message that this class can read.
    • writeMessageBody

      protected int writeMessageBody(byte[] out, int curIndex) throws I2NPMessageException
      Description copied from class: I2NPMessageImpl
      write the message body to the output array, starting at the given index.
      Overrides:
      writeMessageBody in class TunnelBuildMessageBase
      Returns:
      the index into the array after the last byte written (NOT the length)
      Throws:
      I2NPMessageException
    • toString

      public String toString()
      Overrides:
      toString in class TunnelBuildMessage