Class Charsets


  • class Charsets
    extends 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 Detail

      • Charsets

        Charsets()
    • Method Detail

      • toCharset

        static Charset toCharset​(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 Charset toCharset​(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:
        UnsupportedCharsetException - If no support for the named charset is available in this instance of the Java virtual machine
      • toCharsetName

        static String toCharsetName​(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.