code: private static String escape(Object val) {
      if (val == null) {
        return "null";
      } else if (val instanceof TraceableStream) {
        TraceableStream ts = (TraceableStream)val;
        return ts.getStreamTracer().getStreamId().toString();
      } else if (val instanceof FileStatus) {
        FileStatus stat = (FileStatus)val;
        String properties = "isdir=" + stat.isDir() + ",len=" + stat.getLen();
        try {
          return "#"+SimpleBase64.encode(properties.toString().getBytes("UTF-8"));
        } catch (java.io.UnsupportedEncodingException e) {
          return "CouldNotEncode";
        }
      } else if (val instanceof FileStatus[]) {
        FileStatus stat[] = (FileStatus[])val;
        return Integer.toString(stat.length);
      } else if (val instanceof Long) {
        return Long.toString((Long)val);
      } else if (val instanceof Integer) {
        return Integer.toString((Integer)val);
      } else if (val instanceof Short) {
        return Integer.toString((Short)val);
      } else {
        try {
          return "#"+SimpleBase64.encode(val.toString().getBytes("UTF-8"));
        } catch (java.io.UnsupportedEncodingException e) {
          return "CouldNotEncode";
        }
      }
    }
docs: convert