Class CharsetUtils


  • public class CharsetUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      CharsetUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String clean​(java.lang.String charsetName)
      Handle various common charset name errors, and return something that will be considered valid (and is normalized)
      static java.nio.charset.Charset forName​(java.lang.String name)
      Returns Charset impl, if one exists.
      static boolean isSupported​(java.lang.String charsetName)
      Safely return whether is supported, without throwing exceptions
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CharsetUtils

        public CharsetUtils()
    • Method Detail

      • isSupported

        public static boolean isSupported​(java.lang.String charsetName)
        Safely return whether is supported, without throwing exceptions
        Parameters:
        charsetName - Name of charset (can be null)
        Returns:
        true if the character set is supported
      • clean

        public static java.lang.String clean​(java.lang.String charsetName)
        Handle various common charset name errors, and return something that will be considered valid (and is normalized)
        Parameters:
        charsetName - name of charset to process
        Returns:
        potentially remapped/cleaned up version of charset name
      • forName

        public static java.nio.charset.Charset forName​(java.lang.String name)
        Returns Charset impl, if one exists. This method optionally uses ICU4J's CharsetICU.forNameICU, if it is found on the classpath, else only uses JDK's builtin Charset.forName.