Package org.apache.commons.vfs2.util
Class URIUtils.EncodingUtils
- java.lang.Object
-
- org.apache.commons.vfs2.util.URIUtils.EncodingUtils
-
- Enclosing class:
- URIUtils
private static class URIUtils.EncodingUtils extends java.lang.Object
Internal character encoding utilities.This was forked from some needed methods such as
#getBytes(...)
and#getAsciiString(...)
inorg.apache.commons.httpclient.util.EncodingUtil
, in order to not be dependent on HttpClient v3 API, when generating and handlingGenericURLFileName
s, but it should work with any different HTTP backend provider implementations.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
EncodingUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static java.lang.String
getAsciiString(byte[] data, int offset, int length)
Converts the byte array of ASCII characters to a string.(package private) static byte[]
getBytes(java.lang.String data, java.lang.String charsetName)
Converts the specified string to a byte array.
-
-
-
Method Detail
-
getAsciiString
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)- Parameters:
data
- the byte array to be encodedoffset
- the index of the first byte to encodelength
- the number of bytes to encode- Returns:
- The string representation of the byte array
-
getBytes
static byte[] getBytes(java.lang.String data, java.lang.String charsetName)
Converts the specified string to a byte array. If the charset is not supported the default system charset is used.- Parameters:
data
- the string to be encodedcharsetName
- the desired character encoding- Returns:
- The resulting byte array.
-
-