@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
@NotThreadSafe
public final class UriDecoder
extends java.lang.Object
UriEncoder| Modifier and Type | Field and Description |
|---|---|
private java.nio.charset.CharsetDecoder |
decoder |
private java.lang.StringBuilder |
stringBuilder |
private static java.nio.charset.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(java.nio.charset.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 |
|---|---|
java.lang.String |
decode(java.lang.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. |
java.lang.StringBuilder |
decode(java.lang.String eS,
java.lang.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(java.nio.CharBuffer eC) |
private static final java.nio.charset.Charset UTF8
private final java.nio.charset.CharsetDecoder decoder
@CheckForNull private java.lang.StringBuilder stringBuilder
public UriDecoder()
public UriDecoder(java.nio.charset.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!private static int dequote(java.nio.CharBuffer eC)
private static int dequote(char ec)
public java.lang.String decode(java.lang.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.java.lang.IllegalArgumentException - on any decoding error with a
URISyntaxException as its
cause.@CheckForNull
public java.lang.StringBuilder decode(java.lang.String eS,
@CheckForNull
java.lang.StringBuilder dS)
throws java.net.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.java.net.URISyntaxException - on any decoding error.
This exception will leave eS in an undefined state.Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.