| java.lang.Object java.net.URIEncoderDecoder
URIEncoderDecoder | class URIEncoderDecoder (Code) | | This class is used to encode a string using the format required by
application/x-www-form-urlencoded MIME content type.
It contains helper methods used by the URI class, and performs encoding and
decoding in a slightly different way than URLEncoder and URLDecoder.
|
Method Summary | |
static String | decode(String s) Decodes the string argument which is assumed to be encoded in the
x-www-form-urlencoded MIME content type using the UTF-8
encoding scheme.
'%' and two following hex digit characters are converted to the
equivalent byte value. | static String | encodeOthers(String s) Other characters, which are Unicode chars that are not US-ASCII, and are
not ISO Control or are not ISO Space chars are not preserved. | static String | quoteIllegal(String s, String legal) All characters except letters ('a'..'z', 'A'..'Z') and numbers ('0'..'9')
and legal characters are converted into their hexidecimal value prepended
by '%'. | static void | validate(String s, String legal) Validate a string by checking if it contains any characters other than:
1. | static void | validateSimple(String s, String legal) |
decode | static String decode(String s) throws UnsupportedEncodingException(Code) | | Decodes the string argument which is assumed to be encoded in the
x-www-form-urlencoded MIME content type using the UTF-8
encoding scheme.
'%' and two following hex digit characters are converted to the
equivalent byte value. All other characters are passed through
unmodified.
e.g. "A%20B%20C %24%25" -> "A B C $%"
Called from URI.getXYZ() methods
Parameters: s - java.lang.String The encoded string. java.lang.String The decoded version. |
encodeOthers | static String encodeOthers(String s) throws UnsupportedEncodingException(Code) | | Other characters, which are Unicode chars that are not US-ASCII, and are
not ISO Control or are not ISO Space chars are not preserved. They are
converted into their hexidecimal value prepended by '%'.
For example: Euro currency symbol -> "%E2%82%AC".
Called from URI.toASCIIString()
Parameters: s - java.lang.String the string to be converted java.lang.String the converted string |
quoteIllegal | static String quoteIllegal(String s, String legal) throws UnsupportedEncodingException(Code) | | All characters except letters ('a'..'z', 'A'..'Z') and numbers ('0'..'9')
and legal characters are converted into their hexidecimal value prepended
by '%'.
For example: '#' -> %23
Other characters, which are Unicode chars that are not US-ASCII, and are
not ISO Control or are not ISO Space chars, are preserved.
Called from URI.quoteComponent() (for multiple argument constructors)
Parameters: s - java.lang.String the string to be converted Parameters: legal - java.lang.String the characters allowed to be preserved in thestring s java.lang.String the converted string |
validate | static void validate(String s, String legal) throws URISyntaxException(Code) | | Validate a string by checking if it contains any characters other than:
1. letters ('a'..'z', 'A'..'Z') 2. numbers ('0'..'9') 3. characters in
the legalset parameter 4. others (Unicode characters that are not in
US-ASCII set, and are not ISO Control or are not ISO Space characters)
called from URI.Helper.parseURI() to validate each component
Parameters: s - java.lang.String the string to be validated Parameters: legal - java.lang.String the characters allowed in the String s |
|
|