code: public static String encodePath(String path) {
          if (path == null || path.length() == 0)
              return path;
  
          StringBuilder buf = encodePath(null, path, 0);
          return buf == null ? path : buf.toString();
      }
docs: Encode a URI path.
  This is the same encoding offered by URLEncoder, except that
  the '/' character is not encoded.
  
  @param path The path the encode
  @return The encoded path