@NotThreadSafe public final class UriDecoder extends Object
UriEncoder
Constructor and Description |
---|
UriDecoder()
Constructs a new URI decoder which uses the UTF-8 character set to
decode non-US-ASCII characters.
|
UriDecoder(Charset charset)
Constructs a new URI decoder which uses the given character set to
decode non-US-ASCII characters.
|
Modifier and Type | Method and Description |
---|---|
String |
decode(String eS)
Decodes all escape sequences in the string
eS , that is,
each occurence of "%XX", where X is a hexadecimal digit,
gets substituted with the corresponding single byte and the resulting
string gets decoded using the character set provided to the constructor. |
StringBuilder |
decode(String eS,
StringBuilder dS)
Decodes all escape sequences in the string
eS , that is,
each occurence of "%XX", where X is a hexadecimal digit,
gets substituted with the corresponding single byte and the resulting
string gets decoded to the string builder dS using the character
set provided to the constructor. |
public UriDecoder()
public UriDecoder(@CheckForNull Charset charset)
charset
- the character set to use for encoding non-US-ASCII
characters.
If this parameter is null
, then it defaults to
UTF-8
.
Note that providing any other value than null
or
UTF-8
will void interoperability with most applications.public String decode(String eS)
eS
, that is,
each occurence of "%XX", where X is a hexadecimal digit,
gets substituted with the corresponding single byte and the resulting
string gets decoded using the character set provided to the constructor.eS
- the encoded string to decode.IllegalArgumentException
- on any decoding error with a
URISyntaxException
as its
cause
.@CheckForNull public StringBuilder decode(String eS, @CheckForNull StringBuilder dS) throws URISyntaxException
eS
, that is,
each occurence of "%XX", where X is a hexadecimal digit,
gets substituted with the corresponding single byte and the resulting
string gets decoded to the string builder dS
using the character
set provided to the constructor.eS
- the encoded string to decode.dS
- the string builder to which all decoded characters shall get
appended.eS
contains no escape sequences, then null
gets returned.
Otherwise, if dS
is not null
, then it gets
returned with all decoded characters appended to it.
Otherwise, a temporary string builder gets returned which solely
contains all decoded characters.
This temporary string builder may get cleared and reused upon
the next call to any method of this object.URISyntaxException
- on any decoding error.
This exception will leave eS
in an undefined state.Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.