org.apache.commons.httpclient.util
public class EncodingUtil extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
formUrlEncode(NameValuePair[] pairs,
java.lang.String charset)
Form-urlencoding routine.
|
static byte[] |
getAsciiBytes(java.lang.String data)
Converts the specified string to byte array of ASCII characters.
|
static java.lang.String |
getAsciiString(byte[] data)
Converts the byte array of ASCII characters to a string.
|
static java.lang.String |
getAsciiString(byte[] data,
int offset,
int length)
Converts the byte array of ASCII characters to a string.
|
static byte[] |
getBytes(java.lang.String data,
java.lang.String charset)
Converts the specified string to a byte array.
|
static java.lang.String |
getString(byte[] data,
int offset,
int length,
java.lang.String charset)
Converts the byte array of HTTP content characters to a string.
|
static java.lang.String |
getString(byte[] data,
java.lang.String charset)
Converts the byte array of HTTP content characters to a string.
|
public static java.lang.String formUrlEncode(NameValuePair[] pairs, java.lang.String charset)
if the given charset is not supported, ISO-8859-1 is used instead.
pairs - the values to be encodedcharset - the character set of pairs to be encodedpublic static java.lang.String getString(byte[] data,
int offset,
int length,
java.lang.String charset)
data - the byte array to be encodedoffset - the index of the first byte to encodelength - the number of bytes to encodecharset - the desired character encodingpublic static java.lang.String getString(byte[] data,
java.lang.String charset)
data - the byte array to be encodedcharset - the desired character encodingpublic static byte[] getBytes(java.lang.String data,
java.lang.String charset)
data - the string to be encodedcharset - the desired character encodingpublic static byte[] getAsciiBytes(java.lang.String data)
data - the string to be encodedpublic static java.lang.String getAsciiString(byte[] data,
int offset,
int length)
data - the byte array to be encodedoffset - the index of the first byte to encodelength - the number of bytes to encodepublic static java.lang.String getAsciiString(byte[] data)
data - the byte array to be encoded