protected static String encodeDocInfo(Map<String, String> info) {
    if (info == null) {
      return null;
    }

    StringBuilder buf = new StringBuilder();
    for (Entry<String, String> e : info.entrySet()) {
      if (buf.length() > 0) {
        buf.append(';');
      }
      buf.append(e.getKey());
      if (e.getValue() != null) {
        buf.append(':').append(e.getValue());
      }
    }
    return buf.length() > 0 ? buf.toString() : null;
  }