org.apache.jackrabbit.webdav.util
Class EncodeUtil

java.lang.Object
  extended by org.apache.jackrabbit.webdav.util.EncodeUtil

public final class EncodeUtil
extends Object

EncodeUtil provides helper methods for URL encoding and decoding (copied from jcr-commons jackrabbit.util.Text).

See Also:
JCR-2897.

Field Summary
static char[] hexTable
          hextable used for escape(String, char, boolean)
 
Method Summary
static String escape(String string)
          Does a URL encoding of the string.
static String escapePath(String path)
          Does a URL encoding of the path.
static String unescape(String string)
          Does a URL decoding of the string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hexTable

public static final char[] hexTable
hextable used for escape(String, char, boolean)

Method Detail

escape

public static String escape(String string)
Does a URL encoding of the string. 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:
NullPointerException - if string is null.

escapePath

public static String escapePath(String path)
Does a URL encoding of the path. 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 the escape(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:
NullPointerException - if path is null.

unescape

public static String unescape(String string)
Does a URL decoding of the string. Please note that in opposite to the URLDecoder it does not transform the + into spaces.

Parameters:
string - the string to decode
Returns:
the decoded string
Throws:
NullPointerException - if string is null.
ArrayIndexOutOfBoundsException - if not enough character follow an escape character
IllegalArgumentException - if the 2 characters following the escape character do not represent a hex-number.


Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.