forked from I2P_Developers/i2p.i2p
I2NP: Javadoc fixes
Improve DataMessage.toString()
This commit is contained in:
@ -9,6 +9,7 @@ package net.i2p.data.i2np;
|
||||
*/
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.Base64;
|
||||
import net.i2p.data.DataHelper;
|
||||
|
||||
/**
|
||||
@ -99,7 +100,11 @@ public class DataMessage extends FastI2NPMessageImpl {
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("[DataMessage: ");
|
||||
buf.append("\n\tData: ").append(DataHelper.toString(_data, 64));
|
||||
buf.append("\n\tData: ");
|
||||
if (_data != null)
|
||||
buf.append(_data.length).append(" bytes: ").append(Base64.encode(_data));
|
||||
else
|
||||
buf.append("null");
|
||||
buf.append("]");
|
||||
return buf.toString();
|
||||
}
|
||||
|
@ -103,17 +103,17 @@ public interface I2NPMessage extends DataStructure {
|
||||
public int getRawMessageSize();
|
||||
|
||||
/**
|
||||
* write the message to the buffer, returning the number of bytes written.
|
||||
* Write the message to the buffer, returning the new offset (NOT the length).
|
||||
* the data is formatted so as to be self contained, with the type, size,
|
||||
* expiration, unique id, as well as a checksum bundled along.
|
||||
* Full 16 byte header for NTCP 1.
|
||||
*
|
||||
* @return the length written
|
||||
* @return the new offset (NOT the length)
|
||||
*/
|
||||
public int toByteArray(byte buffer[]);
|
||||
|
||||
/**
|
||||
* write the message to the buffer, returning the number of bytes written.
|
||||
* Write the message to the buffer, returning the new offset (NOT the length).
|
||||
* the data is formatted so as to be self contained, with the type, size,
|
||||
* expiration, unique id, as well as a checksum bundled along.
|
||||
* Full 16 byte header for NTCP 1.
|
||||
@ -125,7 +125,7 @@ public interface I2NPMessage extends DataStructure {
|
||||
public int toByteArray(byte buffer[], int off);
|
||||
|
||||
/**
|
||||
* write the message to the buffer, returning the number of bytes written.
|
||||
* Write the message to the buffer, returning the new offset (NOT the length).
|
||||
* the data is is not self contained - it does not include the size,
|
||||
* unique id, or any checksum, but does include the type and expiration.
|
||||
* Short 5 byte header for SSU.
|
||||
@ -135,7 +135,7 @@ public interface I2NPMessage extends DataStructure {
|
||||
public int toRawByteArray(byte buffer[]);
|
||||
|
||||
/**
|
||||
* write the message to the buffer, returning the number of bytes written.
|
||||
* Write the message to the buffer, returning the new offset (NOT the length).
|
||||
* the data is is not self contained - it does not include the size,
|
||||
* unique id, or any checksum, but does include the type and expiration.
|
||||
* Short 9 byte header for NTCP 2.
|
||||
|
@ -108,6 +108,8 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
|
||||
* Set a limit on the max to read from the data buffer, so that
|
||||
* we can use a large buffer but prevent the reader from reading off the end.
|
||||
*
|
||||
* @param type the message type or -1 if we should read it here
|
||||
* @return total length of the message
|
||||
* @param maxLen read no more than this many bytes from data starting at offset, even if it is longer
|
||||
* This includes the type byte only if type < 0
|
||||
* @since 0.8.12
|
||||
@ -236,7 +238,7 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
|
||||
}
|
||||
|
||||
/**
|
||||
* write the message to the buffer, returning the number of bytes written.
|
||||
* Write the message to the buffer, returning the new offset (NOT the length).
|
||||
* the data is formatted so as to be self contained, with the type, size,
|
||||
* expiration, unique id, as well as a checksum bundled along.
|
||||
* Full 16 byte header for NTCP 1.
|
||||
@ -290,7 +292,7 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
|
||||
* THe header consists of a one-byte type and a 4-byte expiration in seconds only.
|
||||
* Used by SSU only!
|
||||
*
|
||||
* @return the new written length
|
||||
* @return the new offset (NOT the length)
|
||||
*/
|
||||
public int toRawByteArray(byte buffer[]) {
|
||||
try {
|
||||
@ -308,7 +310,7 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
|
||||
}
|
||||
|
||||
/**
|
||||
* write the message to the buffer, returning the number of bytes written.
|
||||
* Write the message to the buffer, returning the new offset (NOT the length).
|
||||
* the data is is not self contained - it does not include the size,
|
||||
* unique id, or any checksum, but does include the type and expiration.
|
||||
* Short 9 byte header for NTCP 2.
|
||||
|
Reference in New Issue
Block a user