Class EncodeUtil
- java.lang.Object
-
- org.apache.jackrabbit.webdav.util.EncodeUtil
-
public final class EncodeUtil extends java.lang.Object
EncodeUtil
provides helper methods for URL encoding and decoding (copied from jcr-commons jackrabbit.util.Text).- See Also:
- JCR-2897.
-
-
Field Summary
Fields Modifier and Type Field Description static char[]
hexTable
hextable used forescape(String, char, boolean)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
escape(java.lang.String string)
Does a URL encoding of thestring
.static java.lang.String
escapePath(java.lang.String path)
Does a URL encoding of thepath
.static java.lang.String
unescape(java.lang.String string)
Does a URL decoding of thestring
.
-
-
-
Field Detail
-
hexTable
public static final char[] hexTable
hextable used forescape(String, char, boolean)
-
-
Method Detail
-
escape
public static java.lang.String escape(java.lang.String string)
Does a URL encoding of thestring
. The characters that don't need encoding are those defined 'unreserved' in section 2.3 of the 'URI generic syntax' RFC 2396.- Parameters:
string
- the string to encode- Returns:
- the escaped string
- Throws:
java.lang.NullPointerException
- ifstring
isnull
.
-
escapePath
public static java.lang.String escapePath(java.lang.String path)
Does a URL encoding of thepath
. The characters that don't need encoding are those defined 'unreserved' in section 2.3 of the 'URI generic syntax' RFC 2396. In contrast to theescape(String)
method, not the entire path string is escaped, but every individual part (i.e. the slashes are not escaped).- Parameters:
path
- the path to encode- Returns:
- the escaped path
- Throws:
java.lang.NullPointerException
- ifpath
isnull
.
-
unescape
public static java.lang.String unescape(java.lang.String string)
Does a URL decoding of thestring
. Please note that in opposite to theURLDecoder
it does not transform the + into spaces.- Parameters:
string
- the string to decode- Returns:
- the decoded string
- Throws:
java.lang.NullPointerException
- ifstring
isnull
.java.lang.ArrayIndexOutOfBoundsException
- if not enough character follow an escape characterjava.lang.IllegalArgumentException
- if the 2 characters following the escape character do not represent a hex-number.
-
-