public final class URLEncoding extends Object
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)
See http://www.xins.org/.