public class URIUtil extends Object
Modifier and Type | Field and Description |
---|---|
protected static BitSet |
abs_path
URI absolute path.
|
static BitSet |
allowed_abs_path
Those characters that are allowed for the abs_path.
|
static BitSet |
allowed_query
Those characters that are allowed for the query component.
|
static BitSet |
allowed_within_query
Those characters that are allowed within the query component.
|
protected static BitSet |
alpha
BitSet for alpha.
|
protected static BitSet |
alphanum
BitSet for alphanum (join of alpha & digit).
|
protected static BitSet |
digit
BitSet for digit.
|
protected static BitSet |
escaped
BitSet for escaped.
|
protected static BitSet |
hex
BitSet for hex.
|
protected static BitSet |
mark
BitSet for mark.
|
protected static BitSet |
param
BitSet for param (alias for pchar).
|
protected static BitSet |
path_segments
BitSet for path segments.
|
protected static BitSet |
pchar
BitSet for pchar.
|
protected static BitSet |
percent
The percent "%" character always has the reserved purpose of being the
escape indicator, it must be escaped as "%25" in order to be used as
data within a URI.
|
protected static BitSet |
reserved
BitSet for reserved.
|
protected static BitSet |
segment
BitSet for segment.
|
protected static BitSet |
unreserved
Data characters that are allowed in a URI but do not have a reserved
purpose are called unreserved.
|
protected static BitSet |
uric
BitSet for uric.
|
Constructor and Description |
---|
URIUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
decode(String escaped)
Decode url encoded string.
|
static String |
encode(String unescaped,
BitSet allowed)
URL encode string.
|
static String |
encodePath(String unescaped)
Encode url path.
|
static String |
encodePathQuery(String unescaped)
URL encode path and query string.
|
static String |
encodeWithinQuery(String unescaped)
URL encode query string.
|
static byte[] |
getAsciiBytes(String value) |
static String |
getAsciiString(byte[] bytes)
Convert byte array to an ASCII string value.
|
static byte[] |
getBytes(String value) |
static String |
getString(byte[] bytes)
Convert byte array to a UTF-8 string value.
|
protected static final BitSet percent
protected static final BitSet digit
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
protected static final BitSet alpha
alpha = lowalpha | upalpha
protected static final BitSet alphanum
alphanum = alpha | digit
protected static final BitSet hex
hex = digit | "A" | "B" | "C" | "D" | "E" | "F" | "a" | "b" | "c" | "d" | "e" | "f"
protected static final BitSet escaped
escaped = "%" hex hex
protected static final BitSet mark
mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
protected static final BitSet unreserved
unreserved = alphanum | mark
protected static final BitSet reserved
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ","
protected static final BitSet uric
uric = reserved | unreserved | escaped
protected static final BitSet pchar
pchar = unreserved | escaped | ":" | "@" | "&" | "=" | "+" | "$" | ","
protected static final BitSet param
param = *pchar
protected static final BitSet segment
segment = *pchar *( ";" param )
protected static final BitSet path_segments
path_segments = segment *( "/" segment )
protected static final BitSet abs_path
abs_path = "/" path_segments
public static final BitSet allowed_abs_path
public static final BitSet allowed_query
public static final BitSet allowed_within_query
public static String decode(String escaped) throws IOException
escaped
- encoded stringIOException
- on errorpublic static String encodePath(String unescaped)
unescaped
- unencoded pathpublic static String encode(String unescaped, BitSet allowed)
unescaped
- unencoded stringallowed
- allowed characters bitsetpublic static String encodeWithinQuery(String unescaped)
unescaped
- unencoded query stringpublic static String encodePathQuery(String unescaped)
unescaped
- unencoded path and query stringpublic static byte[] getBytes(String value)
public static byte[] getAsciiBytes(String value)
public static String getAsciiString(byte[] bytes)
bytes
- byte arraypublic static String getString(byte[] bytes)
bytes
- byte arrayCopyright © 2001–2024 MickaĆ«l Guessant. All rights reserved.