Encodes URI string. This is a two mapping, one from original characters to octets, and subsequently a second from octets to URI characters: original character sequence->octet sequence->URI character sequence An escaped octet is encoded as a chara
(String original, BitSet allowed,
String charset)
| 1705 | */ |
| 1706 | |
| 1707 | protected static char[] encode(String original, BitSet allowed, |
| 1708 | String charset) throws URIException { |
| 1709 | if (original == null) { |
| 1710 | throw new IllegalArgumentException("Original string may not be null"); |
| 1711 | } |
| 1712 | if (allowed == null) { |
| 1713 | throw new IllegalArgumentException("Allowed bitset may not be null"); |
| 1714 | } |
| 1715 | byte[] rawdata = URLCodec.encodeUrl(allowed, EncodingUtil.getBytes(original, charset)); |
| 1716 | return EncodingUtil.getAsciiString(rawdata).toCharArray(); |
| 1717 | } |
| 1718 | |
| 1719 | /** |
| 1720 | * Decodes URI encoded string. |
no test coverage detected