/** * 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. */ public static boolean valid(String s, Type t, boolean template) { return _valid(s, t, template) == -1; }
/** * 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. */ public static boolean valid(String s, Type t, boolean template) { return _valid(s, t, template) == -1; }
/** * 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 * @throws IllegalArgumentException if the encoded string contains illegal * characters. */ public static void validate(String s, Type t, boolean template) { int i = _valid(s, t, template); if (i > -1) // TODO localize { throw new IllegalArgumentException("The string '" + s + "' for the URI component " + t + " contains an invalid character, '" + s.charAt(i) + "', at index " + i); } }
/** * 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 * @throws IllegalArgumentException if the encoded string contains illegal * characters. */ public static void validate(String s, Type t, boolean template) { int i = _valid(s, t, template); if (i > -1) // TODO localize { throw new IllegalArgumentException("The string '" + s + "' for the URI component " + t + " contains an invalid character, '" + s.charAt(i) + "', at index " + i); } }