All Implemented Interfaces:
I2CPMessage

public class SetDateMessageextends I2CPMessageImpl
Tell the other side what time it is. Only supported from router to client.

Since 0.8.7, optionally include a version string.

  • Field Details

    • MESSAGE_TYPE

      public static final int MESSAGE_TYPE
      I2CP message type code for a peer clock synchronization request.
      See Also:
    • _date

      private Date _date
      The date the client asks the router to set.
    • _version

      private String _version
      Version string of the client asking.
  • Constructor Details

    • SetDateMessage

      public SetDateMessage()
      Creates a request stamped with the current time and the configured version string.
    • SetDateMessage

      public SetDateMessage(String version)
      Router's version String to be sent to the client; may be null.
      Parameters:
      version - the router's version String to be sent to the client; may be null
  • Method Details

    • getDate

      public Date getDate()
      Returns the sender's clock reading carried by this message.
      Returns:
      the sender's clock reading, never null
    • setDate

      public void setDate(Date date)
      Current router date.
      Parameters:
      date - the router's current date, carried in milliseconds since the epoch
    • getVersion

      public String getVersion()
      Gets the protocol version.
      Returns:
      may be null
    • doReadMessage

      protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException
      Read the message body from the input stream.
      Specified by:
      doReadMessage in class I2CPMessageImpl
      Parameters:
      in - positioned just past the 4 byte size and 1 byte type header
      size - how many payload bytes remain to be read
      Throws:
      I2CPMessageException - if the message format is invalid
      IOException - if there's an error reading from the stream
    • doWriteMessage

      protected byte[] doWriteMessage() throws I2CPMessageException, IOException
      Write the message body to the output stream.
      Specified by:
      doWriteMessage in class I2CPMessageImpl
      Returns:
      byte array
      Throws:
      I2CPMessageException - if the message cannot be written
      IOException - if there's an error writing to the stream
    • getType

      public int getType()
      Returns the I2CP message type code for this message.
      Returns:
      MESSAGE_TYPE, 33
    • toString

      public String toString()
      Returns a string representation of this message.
      Overrides:
      toString in class Object