Package org.apache.commons.vfs2.util
Class URIUtils.EncodingUtils
java.lang.Object
org.apache.commons.vfs2.util.URIUtils.EncodingUtils
- Enclosing class:
URIUtils
Internal character encoding utilities.
This was forked from some needed methods such as #getBytes(...) and #getAsciiString(...)
in org.apache.commons.httpclient.util.EncodingUtil,
in order to not be dependent on HttpClient v3 API, when generating and handling GenericURLFileNames,
but it should work with any different HTTP backend provider implementations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static StringgetAsciiString(byte[] data, int offset, int length) Converts the byte array of ASCII characters to a string.(package private) static byte[]Converts the specified string to a byte array.
-
Constructor Details
-
EncodingUtils
private EncodingUtils()
-
-
Method Details
-
getAsciiString
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
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.
-