code: public static String serializeToString(Writable writable) throws IOException {
      try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
          DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream)) {
        writable.write(dataOutputStream);
        return BaseEncoding.base64().encode(byteArrayOutputStream.toByteArray());
      }
    }
docs: Serialize a {@link Writable} object into a string.
  
  @param writable the {@link Writable} object to be serialized
  @return a string serialized from the {@link Writable} object
  @throws IOException if there's something wrong with the serialization