@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) @NotThreadSafe public final class UriDecoder extends Object
UriEncoder| Modifier and Type | Field and Description |
|---|---|
private CharsetDecoder |
decoder |
private StringBuilder |
stringBuilder |
private static Charset |
UTF8 |
| 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. |
private static int |
dequote(char ec) |
private static int |
dequote(CharBuffer eC) |
private final CharsetDecoder decoder
@CheckForNull private StringBuilder stringBuilder
private static final Charset UTF8
public UriDecoder()
public UriDecoder(Charset charset)
charset - the character set to use for decoding non-US-ASCII
characters.
Note that using any other character set than UTF-8 should 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.private static int dequote(char ec)
private static int dequote(CharBuffer eC)
Copyright © 2004-2011 Schlichtherle IT Services. All Rights Reserved.