Class CharsetUtils

java.lang.Object
org.bardframework.commons.utils.CharsetUtils

public class CharsetUtils extends Object
Demonstrate default Charset-related details.
  • Constructor Details

    • CharsetUtils

      public CharsetUtils()
  • Method Details

    • toCharset

      public static Charset toCharset(String charset)
      Returns a Charset for the named charset. If the name is null, return the default Charset.
      Parameters:
      charset - The name of the requested charset, may be null.
      Returns:
      a Charset for the named charset
      Throws:
      UnsupportedCharsetException - If the named charset is unavailable
    • toCharset

      public static Charset toCharset(Charset charset)
      Returns the given Charset or the default Charset if the given Charset is null.
      Parameters:
      charset - A charset or null.
      Returns:
      the given Charset or the default Charset if the given Charset is null
    • getDefaultEncoding

      public static String getDefaultEncoding()
      Supplies the default encoding without using Charset.defaultCharset() and without accessing System.getProperty("file.encoding").
      Returns:
      Default encoding (default charset).
    • getDefaultLocale

      public static Locale getDefaultLocale()
    • getDefaultCharset

      public static Charset getDefaultCharset()
    • getSunEncoding

      public static String getSunEncoding()
      Returns:
      sun.jnu.encoding
    • getFileEncoding

      public static String getFileEncoding()
      Returns:
      file.encoding