code: public static boolean valid(String s, Type t, boolean template) {
          return _valid(s, t, template) == -1;
      }
docs: Validates the legal characters of a percent-encoded string that
  represents a URI component type.
  
  @param s        the encoded string.
  @param t        the URI component type identifying the legal characters.
  @param template true if the encoded string contains URI template variables
  @return true if the encoded string is valid, otherwise false.