ParsedIRI implements Cloneable, Serializable { public static ParsedIRI create(String str) { try { return new ParsedIRI(str); } catch (URISyntaxException x) { try { int problem = x.getIndex(); StringBuilder sb = new StringBuilder(str); while (true) { int end = sb.offsetByCodePoints(problem, 1); String decoded = sb.substring(problem, end); String encoded = " ".equals(decoded) ? "%20" : URLEncoder.encode(decoded, "UTF-8"); sb.replace(problem, end, encoded); try { return new ParsedIRI(sb.toString()); } catch (URISyntaxException ex) { if (ex.getIndex() <= problem) { throw new IllegalArgumentException(x.getMessage(), x); } else { problem = ex.getIndex(); } } } } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } } } ParsedIRI(String iri);  ParsedIRI(String scheme, String userInfo, String host, int port, String path, String query,
			String fragment); static ParsedIRI create(String str); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); String toASCIIString(); boolean isAbsolute(); boolean isOpaque(); String getScheme(); String getUserInfo(); String getHost(); int getPort(); String getPath(); String getQuery(); String getFragment(); ParsedIRI normalize(); String resolve(String iri); ParsedIRI resolve(ParsedIRI relative); String relativize(String iri); ParsedIRI relativize(ParsedIRI absolute);  }
@Test public void testCreate() { assertEquals("http: ParsedIRI.create("http: assertEquals("Just%20some%0AText!?", ParsedIRI.create("Just some\nText!?").toString()); assertEquals("100%25", ParsedIRI.create("100%").toString()); }