add ModifyPeer command
[jSite2.git] / src / net / pterodactylus / util / fcp / PeerNote.java
1 /**
2  * © 2008 INA Service GmbH
3  */
4 package net.pterodactylus.util.fcp;
5
6
7 /**
8  * The “PeerNote” message contains a private note that has been entered for a
9  * darknet peer.
10  * 
11  * @author <a href="mailto:dr@ina-germany.de">David Roden</a>
12  * @version $Id$
13  */
14 public class PeerNote extends BaseMessage {
15
16         /** The type for base64 encoded peer notes. */
17         public static final int NOTE_TYPE_BASE64 = 1;
18
19         /**
20          * Creates a “PeerNote” message that wraps the recevied message.
21          * 
22          * @param receivedMessage
23          *            The received message
24          */
25         public PeerNote(FcpMessage receivedMessage) {
26                 super(receivedMessage);
27         }
28
29         /**
30          * Returns the note text in whatever format is specified by
31          * {@link #getPeerNoteType()}.
32          * 
33          * @return The note text
34          */
35         public String getNoteText() {
36                 return getField("NoteText");
37         }
38
39         /**
40          * Returns the type of the peer note. The type <code>1</code> means that
41          * the text of the note is base64-encoded.
42          * 
43          * @return The type of the peer note
44          * @throws NumberFormatException
45          *             if the field can not be parsed
46          */
47         public int getPeerNoteType() throws NumberFormatException {
48                 return Integer.valueOf(getField("PeerNoteType"));
49         }
50
51 }