java.lang.Object
org.klomp.snark.URIUtil
URI Holder. This class assists with the decoding and encoding or HTTP URI's. It differs from the java.net.URL class as it does not provide communications ability, but it does assist with query string formatting.
UTF-8 encoding is used by default for % encoded characters. This may be overridden with the org.eclipse.jetty.util.URI.charset system property. see UrlEncoded
I2P modded from Jetty 8.1.15
Constructor Summary
ConstructorsConstructorDescriptionURIUtil()The encode and decode helpers below are static, so an instance carries nothing.Method Summary
Modifier and TypeMethodDescriptionstatic StringencodePath(String path) Encode a URI path.static StringBuilderencodePath(StringBuilder buf, String path) Encode a URI path.private static voidtoHex(byte b, StringBuilder buf) Modded from Jetty TypeUtil.private static voidtoHex(char c, StringBuilder buf) Append the character as one or more %XX escapes, UTF-8 encoded.
Constructor Details
URIUtil
public URIUtil()The encode and decode helpers below are static, so an instance carries nothing.
Method Details
encodePath
encodePath
Encode a URI path.Somewhat oddly, this encodes all chars >= 0x80 if buf is null, (strict RFC 2396) but only the control, space, and special chars if buf is non-null.
- Parameters:
buf- StringBuilder to encode path into (or null)path- The path the encode- Returns:
- The StringBuilder or null if no substitutions required.
toHex
Modded from Jetty TypeUtil.- Parameters:
b- the byte to encodebuf- the builder to append the %XX escape to
toHex
Append the character as one or more %XX escapes, UTF-8 encoded.- Parameters:
c- the character to encodebuf- the builder to append the escapes to