mgmt: fix ndns-add-rr-from-file indicating input format

Change-Id: I8959e783aeec3f440344a163c37fb433a1030c97
Refs: #2258
diff --git a/src/mgmt/management-tool.cpp b/src/mgmt/management-tool.cpp
index c6fc51e..9edd131 100644
--- a/src/mgmt/management-tool.cpp
+++ b/src/mgmt/management-tool.cpp
@@ -30,7 +30,6 @@
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/lexical_cast.hpp>
 
-#include <ndn-cxx/util/io.hpp>
 #include <ndn-cxx/util/regex.hpp>
 #include <ndn-cxx/encoding/oid.hpp>
 #include <ndn-cxx/security/cryptopp.hpp>
@@ -297,7 +296,8 @@
 ManagementTool::addRrSet(const Name& zoneName,
                          const std::string& inFile,
                          const time::seconds& ttl,
-                         const Name& inputDskCertName)
+                         const Name& inputDskCertName,
+                         const ndn::io::IoEncoding encoding)
 {
   //check precondition
   Zone zone(zoneName);
@@ -327,12 +327,12 @@
   //first load the data
   shared_ptr<Data> data;
   if (inFile == DEFAULT_IO)
-    data = ndn::io::load<ndn::Data>(std::cin);
+    data = ndn::io::load<ndn::Data>(std::cin, encoding);
   else
-    data = ndn::io::load<ndn::Data>(inFile);
+    data = ndn::io::load<ndn::Data>(inFile, encoding);
 
   if (data == nullptr) {
-    throw Error("input does not contain a valid Data packet (is it in base64 format?)");
+    throw Error("input does not contain a valid Data packet");
   }
 
   //determine whether the data is a self-signed certificate
diff --git a/src/mgmt/management-tool.hpp b/src/mgmt/management-tool.hpp
index 69fd355..5eabffe 100644
--- a/src/mgmt/management-tool.hpp
+++ b/src/mgmt/management-tool.hpp
@@ -31,6 +31,7 @@
 #include <ndn-cxx/common.hpp>
 #include <ndn-cxx/security/identity-certificate.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/util/io.hpp>
 
 namespace ndn {
 namespace ndns {
@@ -156,12 +157,14 @@
    *  @param dataPath the path to the supplied data
    *  @param ttl the ttl of the rrset
    *  @param dskName the DSK to signed the special case, default is the zone's DSK
+   *  @param encoding the encoding of the input file
     */
   void
   addRrSet(const Name& zoneName,
            const std::string& inFile = DEFAULT_IO,
            const time::seconds& ttl = DEFAULT_RR_TTL,
-           const Name& dskCertName = DEFAULT_CERT);
+           const Name& dskCertName = DEFAULT_CERT,
+           const ndn::io::IoEncoding encoding = ndn::io::BASE_64);
 
   /** @brief remove rrset from the NDNS local database
    *
@@ -178,7 +181,6 @@
    *  @param label rrset's label
    *  @param type rrset's type
    *  @param os the ostream to print information to
-   *  @param isPP indicate pretty print
    */
   void
   getRrSet(const Name& zoneName,