Class CharactersetEncoder

    • Field Detail

      • encoder

        private final java.nio.charset.CharsetEncoder encoder
    • Constructor Detail

      • CharactersetEncoder

        private CharactersetEncoder​(java.lang.String encoding)
    • Method Detail

      • canEncode

        final boolean canEncode​(char c)
        Tells whether or not this encoder can encode the given character.
        Parameters:
        c - the character
        Returns:
        true if, and only if, this encoder can encode the given character
        Throws:
        java.lang.IllegalStateException - - If an encoding operation is already in progress
      • encode

        final CharactersetEncoder.EncodedChars encode​(java.lang.CharSequence chars)
                                               throws java.nio.charset.CharacterCodingException
        Encodes a character sequence to a byte array.
        Parameters:
        chars - the character sequence
        Returns:
        the encoded character sequence
        Throws:
        java.nio.charset.CharacterCodingException - if the encoding operation fails
      • encodeSBCS

        public static CharactersetEncoder.EncodedChars encodeSBCS​(java.lang.CharSequence chars,
                                                                  java.lang.String encoding)
                                                           throws java.nio.charset.CharacterCodingException
        Encodes chars into a format specified by encoding.
        Parameters:
        chars - the character sequence
        encoding - the encoding type
        Returns:
        encoded data
        Throws:
        java.nio.charset.CharacterCodingException - if encoding fails