public static String serializeCommand(Command command) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutput dataOutput = new DataOutputStream(baos);
    ReaderWriter.writeDatum(dataOutput,command.getClass().getName());
    command.write(dataOutput);
    return Base64.getUrlEncoder().encodeToString(baos.toByteArray());
  }
Command implements Writable, but that's not terribly easy to use compared
to String, even if it plugs in easily into the rest of Hadoop. Provide
utility methods to easily serialize and deserialize Commands

serializeCommand returns a base64 String representation of given command
hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/repl/ReplicationUtils.java