Class URIUtils.EncodingUtils

java.lang.Object
org.apache.commons.vfs2.util.URIUtils.EncodingUtils
Enclosing class:
URIUtils

private static class URIUtils.EncodingUtils extends Object
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 Details

    • EncodingUtils

      private EncodingUtils()
  • Method Details

    • getAsciiString

      static 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 encoded
      offset - the index of the first byte to encode
      length - the number of bytes to encode
      Returns:
      The string representation of the byte array
    • getBytes

      static byte[] getBytes(String data, 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 encoded
      charsetName - the desired character encoding
      Returns:
      The resulting byte array.