public class EncodingUtil extends Object
See http://marc.info/?l=httpclient-users&m=125425095705062&w=2 for more informatoin.
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.
|
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 |
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.
|
Modifier and Type | Method and Description |
---|---|
static String |
decode(String escaped)
Unescape and decode a given string regarded as an escaped string with the
UTF-8 protocol charset.
|
static String |
encodePath(String unescaped)
Escape and encode a string regarded as the path component of an URI with
the default protocol charset.
|
static byte[] |
getAsciiBytes(String data)
Converts the specified string to byte array of ASCII characters.
|
static String |
getAsciiString(byte[] data)
Converts the byte array of ASCII characters to a string.
|
static byte[] |
getBytes(String data,
String charset)
Converts the specified string to a byte array.
|
static String |
getString(byte[] data,
String charset)
Converts the byte array of HTTP content characters to a string.
|
public static final BitSet allowed_abs_path
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 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 String encodePath(String unescaped)
unescaped
- an unescaped stringpublic static byte[] getBytes(String data, String charset)
data
- the string to be encodedcharset
- the desired character encodingpublic static String getAsciiString(byte[] data)
data
- the byte array to be encodedpublic static byte[] getAsciiBytes(String data)
data
- the string to be encodedpublic static String getString(byte[] data, String charset)
data
- the byte array to be encodedcharset
- the desired character encodingpublic static String decode(String escaped)
escaped
- a stringIllegalStateException
- if the escaped string is not a correct URLCopyright © 2012–2020 JBoss by Red Hat. All rights reserved.