Class Charsets


  • class Charsets
    extends java.lang.Object
    Internal use only.

    Provides utilities for Charset.

    Package private since Apache Commons IO already provides a Charsets because Charset is in java.nio.charset.

    Since:
    3.10
    • Constructor Summary

      Constructors 
      Constructor Description
      Charsets()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static java.nio.charset.Charset toCharset​(java.lang.String charsetName)
      Returns the given charset or the default Charset if charset is null.
      (package private) static java.nio.charset.Charset toCharset​(java.nio.charset.Charset charset)
      Returns the given charset or the default Charset if charset is null.
      (package private) static java.lang.String toCharsetName​(java.lang.String charsetName)
      Returns the given charset or the default Charset if charset is null.
      • Methods inherited from class java.lang.Object

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

      • Charsets

        Charsets()
    • Method Detail

      • toCharset

        static java.nio.charset.Charset toCharset​(java.nio.charset.Charset charset)
        Returns the given charset or the default Charset if charset is null.
        Parameters:
        charset - a Charset or null.
        Returns:
        the given charset or the default Charset if charset is null.
      • toCharset

        static java.nio.charset.Charset toCharset​(java.lang.String charsetName)
        Returns the given charset or the default Charset if charset is null.
        Parameters:
        charsetName - a Charset or null.
        Returns:
        the given charset or the default Charset if charset is null.
        Throws:
        java.nio.charset.UnsupportedCharsetException - If no support for the named charset is available in this instance of the Java virtual machine
      • toCharsetName

        static java.lang.String toCharsetName​(java.lang.String charsetName)
        Returns the given charset or the default Charset if charset is null.
        Parameters:
        charsetName - a Charset or null.
        Returns:
        the given charset or the default Charset if charset is null.