java.lang.Object
net.i2p.data.i2cp.I2CPMessageImpl
net.i2p.data.i2cp.GetDateMessage
- All Implemented Interfaces:
I2CPMessage
Request the other side to send us what they think the current time is. Only supported from client to router.
Since 0.8.7, optionally include a version string. Since 0.9.11, optionally include options.
Field Summary
Modifier and TypeFieldDescriptionprivate PropertiesConfiguration options of the client asking.private StringVersion string of the client asking.static final intI2CP message type ID written to the wire header.Constructor Summary
ConstructorsConstructorDescriptionBuilds an empty time request; used by I2CP deserialization.GetDateMessage(String version) Client's version String to be sent to the router; may be null.GetDateMessage(String version, Properties options) Defaults in GetDateMessage options are, in general, NOT honored.Method Summary
Public MethodsModifier and TypeMethodDescriptionprotected voiddoReadMessage(InputStream in, int size) Read the message body from the input stream.protected byte[]Write the message body to the output stream.Retrieve any configuration options for the connection.intgetType()I2CP message type sent for this message.Gets the protocol version.toString()Returns a string representation of this message.Methods inherited from class I2CPMessageImpl
readBytes, readMessage, readMessage, sessionId, writeBytes, writeMessageModifier and TypeMethodDescriptionvoidreadBytes(InputStream in) Read the message from the stream, wrapping I2CPMessageException inDataFormatException.voidValidate the type and size of the message, and then read the message into the data structures.voidreadMessage(InputStream in, int length, int type) Read the body into the data structures.Return the SessionId for this type of message.voidwriteBytes(OutputStream out) Write the message to the stream, wrapping I2CPMessageException in DataFormatException.voidwriteMessage(OutputStream out) Write out the full message to the stream, including the 4 byte size and 1 byte type header.
Field Details
MESSAGE_TYPE
public static final int MESSAGE_TYPEI2CP message type ID written to the wire header.- See Also:
_version
Version string of the client asking._options
Configuration options of the client asking.
Constructor Details
GetDateMessage
public GetDateMessage()Builds an empty time request; used by I2CP deserialization.GetDateMessage
Client's version String to be sent to the router; may be null.- Parameters:
version- the client's version String to be sent to the router; may be null
GetDateMessage
Defaults in GetDateMessage options are, in general, NOT honored. Defaults are not serialized out-of-JVM, and the router does not recognize defaults in-JVM. Client side must promote defaults to the primary map.- Parameters:
version- the client's version String to be sent to the router; may be null; must be non-null if options is non-null and non-empty.options- Client options to be sent to the router; primarily for authentication; may be null; keys and values 255 bytes (not chars) max each
Method Details
getVersion
getOptions
Retrieve any configuration options for the connection. Primarily for authentication.- Returns:
- may be null
doReadMessage
Read the message body from the input stream.- Specified by:
doReadMessagein classI2CPMessageImpl- Parameters:
in- positioned just past the 4 byte size and 1 byte type headersize- how many payload bytes remain to be read- Throws:
I2CPMessageException- if the message format is invalidIOException- if there's an error reading from the stream
doWriteMessage
Write the message body to the output stream.- Specified by:
doWriteMessagein classI2CPMessageImpl- Returns:
- byte array
- Throws:
I2CPMessageException- if the message cannot be writtenIOException- if there's an error writing to the stream
getType
public int getType()I2CP message type sent for this message.- Returns:
- the I2CP type number of this message
toString