helma.util
Class UrlEncoded
java.lang.Object
helma.util.UrlEncoded
public final class UrlEncoded
- extends java.lang.Object
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.
Method Summary |
static java.lang.String |
decode(java.lang.String str,
java.lang.String encoding)
URL-decode a string using the given encoding, or return it unchanged if
no encoding was necessary. |
static java.lang.String |
encode(java.lang.String str,
java.lang.String encoding)
URL-encodes a string using the given encoding, or return it unchanged if
no encoding was necessary. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UrlEncoded
public UrlEncoded()
encode
public static java.lang.String encode(java.lang.String str,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
- 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:
java.io.UnsupportedEncodingException
- encoding is not supported
decode
public static java.lang.String decode(java.lang.String str,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
- 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:
java.io.UnsupportedEncodingException
- encoding is not supported
Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.