public class UrlEncoded extends MultiMap<String> implements Cloneable
This class handles the encoding and decoding for either the query string of a URL or the _content of a POST HTTP request.
The hashtable either contains String single values, vectors of String or arrays of Strings.
This class is only partially synchronised. In particular, simple get operations are not protected from concurrent updates.
URLEncoder
,
Serialized FormAbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
UrlEncoded() |
UrlEncoded(String query) |
UrlEncoded(UrlEncoded url) |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
void |
decode(String query) |
void |
decode(String query,
Charset charset) |
static void |
decode88591To(InputStream in,
MultiMap<String> map,
int maxLength,
int maxKeys)
Decoded parameters to Map.
|
static String |
decodeString(String encoded,
int offset,
int length,
Charset charset)
Decode String with % encoding.
|
static void |
decodeTo(InputStream in,
MultiMap<String> map,
Charset charset,
int maxLength,
int maxKeys)
Decoded parameters to Map.
|
static void |
decodeTo(InputStream in,
MultiMap<String> map,
String charset,
int maxLength,
int maxKeys)
Decoded parameters to Map.
|
static void |
decodeTo(String content,
MultiMap<String> map,
Charset charset,
int maxKeys)
Decoded parameters to Map.
|
static void |
decodeTo(String content,
MultiMap<String> map,
String charset,
int maxKeys)
Decoded parameters to Map.
|
static void |
decodeUtf16To(InputStream in,
MultiMap<String> map,
int maxLength,
int maxKeys) |
static void |
decodeUtf8To(byte[] raw,
int offset,
int length,
MultiMap<String> map)
Decoded parameters to Map.
|
static void |
decodeUtf8To(InputStream in,
MultiMap<String> map,
int maxLength,
int maxKeys)
Decoded parameters to Map.
|
String |
encode()
Encode Hashtable with % encoding.
|
String |
encode(Charset charset)
Encode Hashtable with % encoding.
|
String |
encode(Charset charset,
boolean equalsForNullValue)
Encode Hashtable with % encoding.
|
static String |
encode(MultiMap<String> map,
Charset charset,
boolean equalsForNullValue)
Encode Hashtable with % encoding.
|
static String |
encodeString(String string)
Perform URL encoding.
|
static String |
encodeString(String string,
Charset charset)
Perform URL encoding.
|
add, addAllValues, addValues, addValues, containsSimpleValue, getString, getValue, getValues, put, putAllValues, putValues, putValues, removeValue, toString, toStringArrayMap
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
equals, hashCode
public static final Charset ENCODING
public UrlEncoded(UrlEncoded url)
public UrlEncoded()
public UrlEncoded(String query)
public void decode(String query)
public String encode()
public String encode(Charset charset, boolean equalsForNullValue)
equalsForNullValue
- if True, then an '=' is always used, even
for parameters without a value. e.g. "blah?a=&b=&c=".public static String encode(MultiMap<String> map, Charset charset, boolean equalsForNullValue)
equalsForNullValue
- if True, then an '=' is always used, even
for parameters without a value. e.g. "blah?a=&b=&c=".public static void decodeTo(String content, MultiMap<String> map, String charset, int maxKeys)
content
- the string containing the encoded parameterspublic static void decodeTo(String content, MultiMap<String> map, Charset charset, int maxKeys)
content
- the string containing the encoded parameterspublic static void decodeUtf8To(byte[] raw, int offset, int length, MultiMap<String> map)
raw
- the byte[] containing the encoded parametersoffset
- the offset within raw to decode fromlength
- the length of the section to decodemap
- the MultiMap
to populatepublic static void decode88591To(InputStream in, MultiMap<String> map, int maxLength, int maxKeys) throws IOException
in
- InputSteam to readmap
- MultiMap to add parameters tomaxLength
- maximum number of keys to read or -1 for no limitIOException
public static void decodeUtf8To(InputStream in, MultiMap<String> map, int maxLength, int maxKeys) throws IOException
in
- InputSteam to readmap
- MultiMap to add parameters tomaxLength
- maximum number of keys to read or -1 for no limitIOException
public static void decodeUtf16To(InputStream in, MultiMap<String> map, int maxLength, int maxKeys) throws IOException
IOException
public static void decodeTo(InputStream in, MultiMap<String> map, String charset, int maxLength, int maxKeys) throws IOException
in
- the stream containing the encoded parametersIOException
public static void decodeTo(InputStream in, MultiMap<String> map, Charset charset, int maxLength, int maxKeys) throws IOException
in
- the stream containing the encoded parametersIOException
public static String decodeString(String encoded, int offset, int length, Charset charset)
public static String encodeString(String string)
string
- public static String encodeString(String string, Charset charset)
string
- Copyright © 1995-2015 Webtide. All Rights Reserved.