|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xins.common.text.URLEncoding
URL encoding utility functions with Unicode support. This class supports both encoding and decoding. All characters higher than 127 will be encoded as %uxxxx where xxxx is the Unicode value of the character in hexadecimal.
Method Summary | |
static String |
decode(String s)
Decodes the specified URL encoded character string. |
static String |
encode(String s)
URL encodes the specified character string as specified by W3C. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static String encode(String s) throws IllegalArgumentException
s
- the string to URL encode, not null
.
null
.
IllegalArgumentException
- if s == null
public static String decode(String s) throws IllegalArgumentException, FormatException
s
- the URL encoded string to decode, not null
.
null
.
IllegalArgumentException
- if s == null
.
FormatException
- if any of the following conditions is true:
s.charAt
(s.length
() - 1)
(last character is a percentage sign)
s.charAt
(s.length
() - 2)
(before-last character is a percentage sign)
s.charAt
(n) == '%'
&& !( HexConverter
.isDigit
(s.charAt
(n + 1))
&& HexConverter
.isDigit
(s.charAt
(n + 2)))
(percentage sign is followed by 2 characters of which at least one is not a hexadecimal digit)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |