Class CharsetUtil


  • public final class CharsetUtil
    extends Object
    A utility class that provides various common operations and constants related with Charset and its relevant classes.
    • Method Detail

      • encoder

        public static CharsetEncoder encoder​(Charset charset,
                                             CodingErrorAction malformedInputAction,
                                             CodingErrorAction unmappableCharacterAction)
        Returns a new CharsetEncoder for the Charset with specified error actions.
        Parameters:
        charset - The specified charset
        malformedInputAction - The encoder's action for malformed-input errors
        unmappableCharacterAction - The encoder's action for unmappable-character errors
        Returns:
        The encoder for the specified charset
      • encoder

        public static CharsetEncoder encoder​(Charset charset,
                                             CodingErrorAction codingErrorAction)
        Returns a new CharsetEncoder for the Charset with the specified error action.
        Parameters:
        charset - The specified charset
        codingErrorAction - The encoder's action for malformed-input and unmappable-character errors
        Returns:
        The encoder for the specified charset
      • encoder

        public static CharsetEncoder encoder​(Charset charset)
        Returns a cached thread-local CharsetEncoder for the specified Charset.
        Parameters:
        charset - The specified charset
        Returns:
        The encoder for the specified charset
      • decoder

        public static CharsetDecoder decoder​(Charset charset,
                                             CodingErrorAction malformedInputAction,
                                             CodingErrorAction unmappableCharacterAction)
        Returns a new CharsetDecoder for the Charset with specified error actions.
        Parameters:
        charset - The specified charset
        malformedInputAction - The decoder's action for malformed-input errors
        unmappableCharacterAction - The decoder's action for unmappable-character errors
        Returns:
        The decoder for the specified charset
      • decoder

        public static CharsetDecoder decoder​(Charset charset,
                                             CodingErrorAction codingErrorAction)
        Returns a new CharsetDecoder for the Charset with the specified error action.
        Parameters:
        charset - The specified charset
        codingErrorAction - The decoder's action for malformed-input and unmappable-character errors
        Returns:
        The decoder for the specified charset
      • decoder

        public static CharsetDecoder decoder​(Charset charset)
        Returns a cached thread-local CharsetDecoder for the specified Charset.
        Parameters:
        charset - The specified charset
        Returns:
        The decoder for the specified charset