*/
package net.pterodactylus.util.fcp;
-
/**
* The “PeerNote” message contains a private note that has been entered for a
* darknet peer.
public class PeerNote extends BaseMessage {
/** The type for base64 encoded peer notes. */
- public static final int NOTE_TYPE_BASE64 = 1;
+ public static final int TYPE_PRIVATE_PEER_NOTE = 1;
/**
* Creates a “PeerNote” message that wraps the recevied message.
* @param receivedMessage
* The received message
*/
- public PeerNote(FcpMessage receivedMessage) {
+ PeerNote(FcpMessage receivedMessage) {
super(receivedMessage);
}
/**
- * Returns the note text in whatever format is specified by
- * {@link #getPeerNoteType()}.
+ * Returns the base64-encoded note text.
*
* @return The note text
*/
}
/**
- * Returns the type of the peer note. The type <code>1</code> means that
- * the text of the note is base64-encoded.
+ * Returns the type of the peer note.
*
- * @return The type of the peer note
- * @throws NumberFormatException
- * if the field can not be parsed
+ * @return The type of the peer note, or <code>-1</code> if the type can
+ * not be parsed
*/
- public int getPeerNoteType() throws NumberFormatException {
- return Integer.valueOf(getField("PeerNoteType"));
+ public int getPeerNoteType() {
+ return FcpUtils.safeParseInt(getField("PeerNoteType"));
}
}