public class EncodingUtil extends Object
Modifier and Type | Method and Description |
---|---|
static String |
formUrlEncode(NameValuePair[] pairs,
String charset)
Form-urlencoding routine.
|
static byte[] |
getAsciiBytes(String data)
Converts the specified string to byte array of ASCII characters.
|
static String |
getAsciiString(byte[] data)
Converts the byte array of ASCII characters to a string.
|
static String |
getAsciiString(byte[] data,
int offset,
int length)
Converts the byte array of ASCII characters to a string.
|
static byte[] |
getBytes(String data,
String charset)
Converts the specified string to a byte array.
|
static String |
getString(byte[] data,
int offset,
int length,
String charset)
Converts the byte array of HTTP content characters to a string.
|
static String |
getString(byte[] data,
String charset)
Converts the byte array of HTTP content characters to a string.
|
public static String formUrlEncode(NameValuePair[] pairs, 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 String getString(byte[] data, int offset, int length, 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 String getString(byte[] data, String charset)
data
- the byte array to be encodedcharset
- the desired character encodingpublic static byte[] getBytes(String data, String charset)
data
- the string to be encodedcharset
- the desired character encodingpublic static byte[] getAsciiBytes(String data)
data
- the string to be encodedpublic static 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 String getAsciiString(byte[] data)
data
- the byte array to be encodedCopyright © 2019. All Rights Reserved.