Automatically en- and decode peer note texts
[jFCPlib.git] / src / main / java / net / pterodactylus / fcp / ModifyPeerNote.java
index 67691ab..c7338ff 100644 (file)
@@ -18,6 +18,8 @@
 
 package net.pterodactylus.fcp;
 
+import com.google.common.base.Charsets;
+
 /**
  * The “ModifyPeerNote” command modifies a peer note.
  *
@@ -25,6 +27,8 @@ package net.pterodactylus.fcp;
  */
 public class ModifyPeerNote extends FcpMessage {
 
+       private static final FreenetBase64 BASE64_ENCODER = new FreenetBase64();
+
        public ModifyPeerNote(String identifier, String nodeIdentifier) {
                super("ModifyPeerNote");
                setField("Identifier", identifier);
@@ -40,7 +44,7 @@ public class ModifyPeerNote extends FcpMessage {
        }
 
        public void setNoteText(String noteText) {
-               setField("NoteText", noteText);
+               setField("NoteText", BASE64_ENCODER.encode(noteText.getBytes(Charsets.UTF_8)));
        }
 
        public void setPeerNoteType(PeerNoteType peerNoteType) {