public final class EncodeUtil
extends java.lang.Object
EncodeUtil
provides helper methods for URL encoding and decoding
(copied from jcr-commons jackrabbit.util.Text).Modifier and Type | Field and Description |
---|---|
static char[] |
hexTable
hextable used for
escape(String, char, boolean) |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
escape(java.lang.String string)
Does a URL encoding of the
string . |
static java.lang.String |
escapePath(java.lang.String path)
Does a URL encoding of the
path . |
static java.lang.String |
unescape(java.lang.String string)
Does a URL decoding of the
string . |
public static final char[] hexTable
escape(String, char, boolean)
public static java.lang.String escape(java.lang.String string)
string
. The characters that
don't need encoding are those defined 'unreserved' in section 2.3 of
the 'URI generic syntax' RFC 2396.string
- the string to encodejava.lang.NullPointerException
- if string
is null
.public static java.lang.String escapePath(java.lang.String path)
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).path
- the path to encodejava.lang.NullPointerException
- if path
is null
.public static java.lang.String unescape(java.lang.String string)
string
. Please note that in
opposite to the URLDecoder
it does not transform the +
into spaces.string
- the string to decodejava.lang.NullPointerException
- if string
is null
.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."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"