Methods Summary |
---|
public static byte[] | getAsciiBytes(java.lang.String data)Converts the specified string to byte array of ASCII characters.
if (data == null) {
throw new IllegalArgumentException("Parameter may not be null");
}
try {
return data.getBytes(HTTP.US_ASCII);
} catch (UnsupportedEncodingException e) {
throw new Error("HttpClient requires ASCII support");
}
|
public static java.lang.String | getAsciiString(byte[] data, int offset, int length)Converts the byte array of ASCII characters to a string. This method is
to be used when decoding content of HTTP elements (such as response
headers)
if (data == null) {
throw new IllegalArgumentException("Parameter may not be null");
}
try {
return new String(data, offset, length, HTTP.US_ASCII);
} catch (UnsupportedEncodingException e) {
throw new Error("HttpClient requires ASCII support");
}
|
public static java.lang.String | getAsciiString(byte[] data)Converts the byte array of ASCII characters to a string. This method is
to be used when decoding content of HTTP elements (such as response
headers)
if (data == null) {
throw new IllegalArgumentException("Parameter may not be null");
}
return getAsciiString(data, 0, data.length);
|
public static byte[] | getBytes(java.lang.String data, java.lang.String charset)Converts the specified string to a byte array. If the charset is not supported the
default system charset is used.
if (data == null) {
throw new IllegalArgumentException("data may not be null");
}
if (charset == null || charset.length() == 0) {
throw new IllegalArgumentException("charset may not be null or empty");
}
try {
return data.getBytes(charset);
} catch (UnsupportedEncodingException e) {
return data.getBytes();
}
|
public 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. If
the specified charset is not supported, default system encoding
is used.
if (data == null) {
throw new IllegalArgumentException("Parameter may not be null");
}
if (charset == null || charset.length() == 0) {
throw new IllegalArgumentException("charset may not be null or empty");
}
try {
return new String(data, offset, length, charset);
} catch (UnsupportedEncodingException e) {
return new String(data, offset, length);
}
|
public static java.lang.String | getString(byte[] data, java.lang.String charset)Converts the byte array of HTTP content characters to a string. If
the specified charset is not supported, default system encoding
is used.
if (data == null) {
throw new IllegalArgumentException("Parameter may not be null");
}
return getString(data, 0, data.length, charset);
|