JavaDoc fixes
This commit is contained in:
@ -49,15 +49,18 @@ public class AbuseReason extends DataStructureImpl {
|
|||||||
DataHelper.writeString(out, _reason);
|
DataHelper.writeString(out, _reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object == null) || !(object instanceof AbuseReason)) return false;
|
if ((object == null) || !(object instanceof AbuseReason)) return false;
|
||||||
return DataHelper.eq(getReason(), ((AbuseReason) object).getReason());
|
return DataHelper.eq(getReason(), ((AbuseReason) object).getReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return DataHelper.hashCode(getReason());
|
return DataHelper.hashCode(getReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[AbuseReason: " + getReason() + "]";
|
return "[AbuseReason: " + getReason() + "]";
|
||||||
}
|
}
|
||||||
|
@ -50,15 +50,18 @@ public class AbuseSeverity extends DataStructureImpl {
|
|||||||
DataHelper.writeLong(out, 1, _severityId);
|
DataHelper.writeLong(out, 1, _severityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object == null) || !(object instanceof AbuseSeverity)) return false;
|
if ((object == null) || !(object instanceof AbuseSeverity)) return false;
|
||||||
return DataHelper.eq(getSeverity(), ((AbuseSeverity) object).getSeverity());
|
return DataHelper.eq(getSeverity(), ((AbuseSeverity) object).getSeverity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getSeverity();
|
return getSeverity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[AbuseSeverity: " + getSeverity() + "]";
|
return "[AbuseSeverity: " + getSeverity() + "]";
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,7 @@ public class CreateLeaseSetMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof CreateLeaseSetMessage)) {
|
if ((object != null) && (object instanceof CreateLeaseSetMessage)) {
|
||||||
CreateLeaseSetMessage msg = (CreateLeaseSetMessage) object;
|
CreateLeaseSetMessage msg = (CreateLeaseSetMessage) object;
|
||||||
@ -123,6 +124,7 @@ public class CreateLeaseSetMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[CreateLeaseSetMessage: ");
|
buf.append("[CreateLeaseSetMessage: ");
|
||||||
|
@ -70,6 +70,7 @@ public class CreateSessionMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof CreateSessionMessage)) {
|
if ((object != null) && (object instanceof CreateSessionMessage)) {
|
||||||
CreateSessionMessage msg = (CreateSessionMessage) object;
|
CreateSessionMessage msg = (CreateSessionMessage) object;
|
||||||
@ -79,6 +80,7 @@ public class CreateSessionMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[CreateSessionMessage: ");
|
buf.append("[CreateSessionMessage: ");
|
||||||
|
@ -66,6 +66,7 @@ public class DestroySessionMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof DestroySessionMessage)) {
|
if ((object != null) && (object instanceof DestroySessionMessage)) {
|
||||||
DestroySessionMessage msg = (DestroySessionMessage) object;
|
DestroySessionMessage msg = (DestroySessionMessage) object;
|
||||||
@ -75,6 +76,7 @@ public class DestroySessionMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[DestroySessionMessage: ");
|
buf.append("[DestroySessionMessage: ");
|
||||||
|
@ -62,6 +62,7 @@ public class DisconnectMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof DisconnectMessage)) {
|
if ((object != null) && (object instanceof DisconnectMessage)) {
|
||||||
DisconnectMessage msg = (DisconnectMessage) object;
|
DisconnectMessage msg = (DisconnectMessage) object;
|
||||||
@ -71,6 +72,7 @@ public class DisconnectMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[DisconnectMessage: ");
|
buf.append("[DisconnectMessage: ");
|
||||||
|
@ -39,6 +39,7 @@ public class GetDateMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof GetDateMessage)) {
|
if ((object != null) && (object instanceof GetDateMessage)) {
|
||||||
return true;
|
return true;
|
||||||
@ -47,6 +48,7 @@ public class GetDateMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[GetDateMessage]");
|
buf.append("[GetDateMessage]");
|
||||||
|
@ -52,6 +52,7 @@ public interface I2CPMessage extends DataStructure {
|
|||||||
* Write the current message to the output stream as a full message following
|
* Write the current message to the output stream as a full message following
|
||||||
* the specification from the I2CP definition.
|
* the specification from the I2CP definition.
|
||||||
*
|
*
|
||||||
|
* @param out OutputStream
|
||||||
* @throws I2CPMessageException if the current object doesn't have sufficient data
|
* @throws I2CPMessageException if the current object doesn't have sufficient data
|
||||||
* to write a properly formatted message.
|
* to write a properly formatted message.
|
||||||
* @throws IOException if there is a problem writing to the stream
|
* @throws IOException if there is a problem writing to the stream
|
||||||
@ -61,6 +62,7 @@ public interface I2CPMessage extends DataStructure {
|
|||||||
/**
|
/**
|
||||||
* Return the unique identifier for this type of APIMessage, as specified in the
|
* Return the unique identifier for this type of APIMessage, as specified in the
|
||||||
* network specification document under #ClientAccessLayerMessages
|
* network specification document under #ClientAccessLayerMessages
|
||||||
|
* @return unique identifier for this type of APIMessage
|
||||||
*/
|
*/
|
||||||
public int getType();
|
public int getType();
|
||||||
}
|
}
|
@ -27,6 +27,8 @@ public class I2CPMessageHandler {
|
|||||||
/**
|
/**
|
||||||
* Read an I2CPMessage from the stream and return the fully populated object.
|
* Read an I2CPMessage from the stream and return the fully populated object.
|
||||||
*
|
*
|
||||||
|
* @param in I2CP input stream
|
||||||
|
* @return Fully populated I2CPMessage
|
||||||
* @throws IOException if there is an IO problem reading from the stream
|
* @throws IOException if there is an IO problem reading from the stream
|
||||||
* @throws I2CPMessageException if there is a problem handling the particular
|
* @throws I2CPMessageException if there is a problem handling the particular
|
||||||
* message - if it is an unknown type or has improper formatting, etc.
|
* message - if it is an unknown type or has improper formatting, etc.
|
||||||
|
@ -32,6 +32,7 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
|||||||
/**
|
/**
|
||||||
* Validate the type and size of the message, and then read the message into the data structures. <p />
|
* Validate the type and size of the message, and then read the message into the data structures. <p />
|
||||||
*
|
*
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void readMessage(InputStream in) throws I2CPMessageException, IOException {
|
public void readMessage(InputStream in) throws I2CPMessageException, IOException {
|
||||||
int length = 0;
|
int length = 0;
|
||||||
@ -53,6 +54,8 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
|||||||
/**
|
/**
|
||||||
* Read the body into the data structures
|
* Read the body into the data structures
|
||||||
*
|
*
|
||||||
|
* @param length number of bytes in the message payload
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException {
|
public void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException {
|
||||||
if (type != getType())
|
if (type != getType())
|
||||||
@ -77,6 +80,10 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
|||||||
* Read in the payload part of the message (after the initial 4 byte size and 1
|
* Read in the payload part of the message (after the initial 4 byte size and 1
|
||||||
* byte type)
|
* byte type)
|
||||||
*
|
*
|
||||||
|
* @param buf InputStream
|
||||||
|
* @param size payload size
|
||||||
|
* @throws I2CPMessageException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
protected abstract void doReadMessage(InputStream buf, int size) throws I2CPMessageException, IOException;
|
protected abstract void doReadMessage(InputStream buf, int size) throws I2CPMessageException, IOException;
|
||||||
|
|
||||||
@ -84,6 +91,9 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
|||||||
* Write out the payload part of the message (not including the 4 byte size and
|
* Write out the payload part of the message (not including the 4 byte size and
|
||||||
* 1 byte type)
|
* 1 byte type)
|
||||||
*
|
*
|
||||||
|
* @return byte array
|
||||||
|
* @throws I2CPMessageException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
protected abstract byte[] doWriteMessage() throws I2CPMessageException, IOException;
|
protected abstract byte[] doWriteMessage() throws I2CPMessageException, IOException;
|
||||||
|
|
||||||
@ -91,6 +101,7 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
|||||||
* Write out the full message to the stream, including the 4 byte size and 1
|
* Write out the full message to the stream, including the 4 byte size and 1
|
||||||
* byte type header.
|
* byte type header.
|
||||||
*
|
*
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
||||||
byte[] data = doWriteMessage();
|
byte[] data = doWriteMessage();
|
||||||
|
@ -91,6 +91,8 @@ public class I2CPMessageReader {
|
|||||||
* Notify the listener that a message has been received from the given
|
* Notify the listener that a message has been received from the given
|
||||||
* reader
|
* reader
|
||||||
*
|
*
|
||||||
|
* @param reader I2CPMessageReader to notify
|
||||||
|
* @param message the I2CPMessage
|
||||||
*/
|
*/
|
||||||
public void messageReceived(I2CPMessageReader reader, I2CPMessage message);
|
public void messageReceived(I2CPMessageReader reader, I2CPMessage message);
|
||||||
|
|
||||||
@ -98,6 +100,8 @@ public class I2CPMessageReader {
|
|||||||
* Notify the listener that an exception was thrown while reading from the given
|
* Notify the listener that an exception was thrown while reading from the given
|
||||||
* reader
|
* reader
|
||||||
*
|
*
|
||||||
|
* @param reader I2CPMessageReader to notify
|
||||||
|
* @param error Exception that was thrown
|
||||||
*/
|
*/
|
||||||
public void readError(I2CPMessageReader reader, Exception error);
|
public void readError(I2CPMessageReader reader, Exception error);
|
||||||
|
|
||||||
@ -105,6 +109,7 @@ public class I2CPMessageReader {
|
|||||||
* Notify the listener that the stream the given reader was running off
|
* Notify the listener that the stream the given reader was running off
|
||||||
* closed
|
* closed
|
||||||
*
|
*
|
||||||
|
* @param reader I2CPMessageReader to notify
|
||||||
*/
|
*/
|
||||||
public void disconnected(I2CPMessageReader reader);
|
public void disconnected(I2CPMessageReader reader);
|
||||||
}
|
}
|
||||||
|
@ -52,15 +52,18 @@ public class MessageId extends DataStructureImpl {
|
|||||||
DataHelper.writeLong(out, 4, _messageId);
|
DataHelper.writeLong(out, 4, _messageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object == null) || !(object instanceof MessageId)) return false;
|
if ((object == null) || !(object instanceof MessageId)) return false;
|
||||||
return DataHelper.eq(getMessageId(), ((MessageId) object).getMessageId());
|
return DataHelper.eq(getMessageId(), ((MessageId) object).getMessageId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (int)getMessageId();
|
return (int)getMessageId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[MessageId: " + getMessageId() + "]";
|
return "[MessageId: " + getMessageId() + "]";
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,9 @@ public class MessagePayloadMessage extends I2CPMessageImpl {
|
|||||||
* Write out the full message to the stream, including the 4 byte size and 1
|
* Write out the full message to the stream, including the 4 byte size and 1
|
||||||
* byte type header.
|
* byte type header.
|
||||||
*
|
*
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
||||||
if (_sessionId <= 0)
|
if (_sessionId <= 0)
|
||||||
throw new I2CPMessageException("Unable to write out the message, as the session ID has not been defined");
|
throw new I2CPMessageException("Unable to write out the message, as the session ID has not been defined");
|
||||||
@ -106,6 +108,7 @@ public class MessagePayloadMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof MessagePayloadMessage)) {
|
if ((object != null) && (object instanceof MessagePayloadMessage)) {
|
||||||
MessagePayloadMessage msg = (MessagePayloadMessage) object;
|
MessagePayloadMessage msg = (MessagePayloadMessage) object;
|
||||||
@ -117,6 +120,7 @@ public class MessagePayloadMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[MessagePayloadMessage: ");
|
buf.append("[MessagePayloadMessage: ");
|
||||||
|
@ -121,7 +121,9 @@ public class MessageStatusMessage extends I2CPMessageImpl {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Override to reduce mem churn
|
* Override to reduce mem churn
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
||||||
int len = 2 + // sessionId
|
int len = 2 + // sessionId
|
||||||
4 + // messageId
|
4 + // messageId
|
||||||
@ -150,6 +152,7 @@ public class MessageStatusMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof MessageStatusMessage)) {
|
if ((object != null) && (object instanceof MessageStatusMessage)) {
|
||||||
MessageStatusMessage msg = (MessageStatusMessage) object;
|
MessageStatusMessage msg = (MessageStatusMessage) object;
|
||||||
@ -161,6 +164,7 @@ public class MessageStatusMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[MessageStatusMessage: ");
|
buf.append("[MessageStatusMessage: ");
|
||||||
|
@ -66,7 +66,9 @@ public class ReceiveMessageBeginMessage extends I2CPMessageImpl {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Override to reduce mem churn
|
* Override to reduce mem churn
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
||||||
int len = 2 + // sessionId
|
int len = 2 + // sessionId
|
||||||
4; // messageId
|
4; // messageId
|
||||||
@ -86,6 +88,7 @@ public class ReceiveMessageBeginMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof ReceiveMessageBeginMessage)) {
|
if ((object != null) && (object instanceof ReceiveMessageBeginMessage)) {
|
||||||
ReceiveMessageBeginMessage msg = (ReceiveMessageBeginMessage) object;
|
ReceiveMessageBeginMessage msg = (ReceiveMessageBeginMessage) object;
|
||||||
@ -96,6 +99,7 @@ public class ReceiveMessageBeginMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[ReceiveMessageBeginMessage: ");
|
buf.append("[ReceiveMessageBeginMessage: ");
|
||||||
|
@ -71,6 +71,7 @@ public class ReceiveMessageEndMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof ReceiveMessageEndMessage)) {
|
if ((object != null) && (object instanceof ReceiveMessageEndMessage)) {
|
||||||
ReceiveMessageEndMessage msg = (ReceiveMessageEndMessage) object;
|
ReceiveMessageEndMessage msg = (ReceiveMessageEndMessage) object;
|
||||||
@ -81,6 +82,7 @@ public class ReceiveMessageEndMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[ReceiveMessageEndMessage: ");
|
buf.append("[ReceiveMessageEndMessage: ");
|
||||||
|
@ -108,6 +108,7 @@ public class ReportAbuseMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof ReportAbuseMessage)) {
|
if ((object != null) && (object instanceof ReportAbuseMessage)) {
|
||||||
ReportAbuseMessage msg = (ReportAbuseMessage) object;
|
ReportAbuseMessage msg = (ReportAbuseMessage) object;
|
||||||
@ -118,6 +119,7 @@ public class ReportAbuseMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[ReportAbuseMessage: ");
|
buf.append("[ReportAbuseMessage: ");
|
||||||
|
@ -124,6 +124,7 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof RequestLeaseSetMessage)) {
|
if ((object != null) && (object instanceof RequestLeaseSetMessage)) {
|
||||||
RequestLeaseSetMessage msg = (RequestLeaseSetMessage) object;
|
RequestLeaseSetMessage msg = (RequestLeaseSetMessage) object;
|
||||||
@ -138,6 +139,7 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[RequestLeaseMessage: ");
|
buf.append("[RequestLeaseMessage: ");
|
||||||
|
@ -79,7 +79,9 @@ public class SendMessageMessage extends I2CPMessageImpl {
|
|||||||
/**
|
/**
|
||||||
* Read the body into the data structures
|
* Read the body into the data structures
|
||||||
*
|
*
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException {
|
public void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException {
|
||||||
if (type != getType())
|
if (type != getType())
|
||||||
throw new I2CPMessageException("Invalid message type (found: " + type + " supported: " + getType()
|
throw new I2CPMessageException("Invalid message type (found: " + type + " supported: " + getType()
|
||||||
@ -107,7 +109,9 @@ public class SendMessageMessage extends I2CPMessageImpl {
|
|||||||
* Write out the full message to the stream, including the 4 byte size and 1
|
* Write out the full message to the stream, including the 4 byte size and 1
|
||||||
* byte type header. Override the parent so we can be more mem efficient
|
* byte type header. Override the parent so we can be more mem efficient
|
||||||
*
|
*
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
||||||
if ((_sessionId == null) || (_destination == null) || (_payload == null) || (_nonce <= 0))
|
if ((_sessionId == null) || (_destination == null) || (_payload == null) || (_nonce <= 0))
|
||||||
throw new I2CPMessageException("Unable to write out the message as there is not enough data");
|
throw new I2CPMessageException("Unable to write out the message as there is not enough data");
|
||||||
@ -129,6 +133,7 @@ public class SendMessageMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof SendMessageMessage)) {
|
if ((object != null) && (object instanceof SendMessageMessage)) {
|
||||||
SendMessageMessage msg = (SendMessageMessage) object;
|
SendMessageMessage msg = (SendMessageMessage) object;
|
||||||
@ -140,6 +145,7 @@ public class SendMessageMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[SendMessageMessage: ");
|
buf.append("[SendMessageMessage: ");
|
||||||
|
@ -59,6 +59,7 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
/**
|
/**
|
||||||
* Retrieve the destination for which this session is supposed to connect
|
* Retrieve the destination for which this session is supposed to connect
|
||||||
*
|
*
|
||||||
|
* @return Destination for this session
|
||||||
*/
|
*/
|
||||||
public Destination getDestination() {
|
public Destination getDestination() {
|
||||||
return _destination;
|
return _destination;
|
||||||
@ -68,6 +69,7 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
* Determine when this session was authorized by the destination (so we can
|
* Determine when this session was authorized by the destination (so we can
|
||||||
* prevent replay attacks)
|
* prevent replay attacks)
|
||||||
*
|
*
|
||||||
|
* @return Date
|
||||||
*/
|
*/
|
||||||
public Date getCreationDate() {
|
public Date getCreationDate() {
|
||||||
return _creationDate;
|
return _creationDate;
|
||||||
@ -80,6 +82,7 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
/**
|
/**
|
||||||
* Retrieve any configuration options for the session
|
* Retrieve any configuration options for the session
|
||||||
*
|
*
|
||||||
|
* @return Properties of this session
|
||||||
*/
|
*/
|
||||||
public Properties getOptions() {
|
public Properties getOptions() {
|
||||||
return _options;
|
return _options;
|
||||||
@ -88,6 +91,7 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
/**
|
/**
|
||||||
* Configure the session with the given options
|
* Configure the session with the given options
|
||||||
*
|
*
|
||||||
|
* @param options Properties for this session
|
||||||
*/
|
*/
|
||||||
public void setOptions(Properties options) {
|
public void setOptions(Properties options) {
|
||||||
_options = options;
|
_options = options;
|
||||||
@ -104,6 +108,8 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
/**
|
/**
|
||||||
* Sign the structure using the supplied private key
|
* Sign the structure using the supplied private key
|
||||||
*
|
*
|
||||||
|
* @param signingKey SigningPrivateKey to sign with
|
||||||
|
* @throws DataFormatException
|
||||||
*/
|
*/
|
||||||
public void signSessionConfig(SigningPrivateKey signingKey) throws DataFormatException {
|
public void signSessionConfig(SigningPrivateKey signingKey) throws DataFormatException {
|
||||||
byte data[] = getBytes();
|
byte data[] = getBytes();
|
||||||
@ -197,6 +203,7 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
_signature.writeBytes(out);
|
_signature.writeBytes(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof SessionConfig)) {
|
if ((object != null) && (object instanceof SessionConfig)) {
|
||||||
SessionConfig cfg = (SessionConfig) object;
|
SessionConfig cfg = (SessionConfig) object;
|
||||||
@ -209,6 +216,7 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer("[SessionConfig: ");
|
StringBuffer buf = new StringBuffer("[SessionConfig: ");
|
||||||
buf.append("\n\tDestination: ").append(getDestination());
|
buf.append("\n\tDestination: ").append(getDestination());
|
||||||
|
@ -49,15 +49,18 @@ public class SessionId extends DataStructureImpl {
|
|||||||
DataHelper.writeLong(out, 2, _sessionId);
|
DataHelper.writeLong(out, 2, _sessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if ((obj == null) || !(obj instanceof SessionId)) return false;
|
if ((obj == null) || !(obj instanceof SessionId)) return false;
|
||||||
return getSessionId() == ((SessionId) obj).getSessionId();
|
return getSessionId() == ((SessionId) obj).getSessionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getSessionId();
|
return getSessionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[SessionId: " + getSessionId() + "]";
|
return "[SessionId: " + getSessionId() + "]";
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@ public class SessionStatusMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof SessionStatusMessage)) {
|
if ((object != null) && (object instanceof SessionStatusMessage)) {
|
||||||
SessionStatusMessage msg = (SessionStatusMessage) object;
|
SessionStatusMessage msg = (SessionStatusMessage) object;
|
||||||
@ -91,6 +92,7 @@ public class SessionStatusMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[SessionStatusMessage: ");
|
buf.append("[SessionStatusMessage: ");
|
||||||
|
@ -65,6 +65,7 @@ public class SetDateMessage extends I2CPMessageImpl {
|
|||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof SetDateMessage)) {
|
if ((object != null) && (object instanceof SetDateMessage)) {
|
||||||
SetDateMessage msg = (SetDateMessage) object;
|
SetDateMessage msg = (SetDateMessage) object;
|
||||||
@ -74,6 +75,7 @@ public class SetDateMessage extends I2CPMessageImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[SetDateMessage");
|
buf.append("[SetDateMessage");
|
||||||
|
Reference in New Issue
Block a user