Package org.apache.commons.io.charset

# Class CharsetEncoders

java.lang.Object
org.apache.commons.io.charset.CharsetEncoders

public final class CharsetEncoders extends Object
Works with `CharsetEncoder`.

Since:
  2.12.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static CharsetEncoder`
  `toCharsetEncoder(CharsetEncoder charsetEncoder)`
  Returns the given non-null CharsetEncoder or a new default CharsetEncoder.
  `static CharsetEncoder`
  `toCharsetEncoder(CharsetEncoder charsetEncoder, Supplier<CharsetEncoder> defaultSupplier)`
  Returns the given non-null CharsetEncoder or a new default CharsetEncoder.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### toCharsetEncoder

    public static CharsetEncoder toCharsetEncoder(CharsetEncoder charsetEncoder)
    Returns the given non-null CharsetEncoder or a new default CharsetEncoder.
    Parameters:
      `charsetEncoder` - The CharsetEncoder to test.
    Returns:
      the given non-null CharsetEncoder or a new default CharsetEncoder.

  - ### toCharsetEncoder

    public static CharsetEncoder toCharsetEncoder(CharsetEncoder charsetEncoder, Supplier<CharsetEncoder> defaultSupplier)
    Returns the given non-null CharsetEncoder or a new default CharsetEncoder.
    Parameters:
      `charsetEncoder` - The CharsetEncoder to test.
      `defaultSupplier` - The CharsetEncoder supplier to get when charsetEncoder is null.
    Returns:
      the given non-null CharsetEncoder or a new default CharsetEncoder.
    Since:
      2.13.0