Package helma.util
Class UrlEncoded
java.lang.Object
helma.util.UrlEncoded
A proxy to java.net.URLEncoder which only encodes when there is actual work
to do. This is necessary because URLEncoder is quite inefficient (e.g. it
preallocates buffers and stuff), and we call it often with short string that
don't need encoding.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
UrlEncoded
public UrlEncoded()
-
-
Method Details
-
encode
URL-encodes a string using the given encoding, or return it unchanged if no encoding was necessary.- Parameters:
str
- The string to be URL-encodedencoding
- the encoding to use- Returns:
- the URL-encoded string, or str if no encoding necessary
- Throws:
UnsupportedEncodingException
- encoding is not supported
-
decode
URL-decode a string using the given encoding, or return it unchanged if no encoding was necessary.- Parameters:
str
- The string to be URL-decodedencoding
- the encoding to use- Returns:
- the URL-decoded string, or str if no decoding necessary
- Throws:
UnsupportedEncodingException
- encoding is not supported
-