Class EncodingUtil


  • public class EncodingUtil
    extends Object
    Helper for handling encodings.
    • Field Detail

      • EIGHT_BIT_ENCODING

        public static final String EIGHT_BIT_ENCODING
        Constant for 8-Bit encoding, which can be resembled by "ISO-8859-1"
        See Also:
        Constant Field Values
      • CHARSET_EIGHT_BIT_ENCODING

        public static final Charset CHARSET_EIGHT_BIT_ENCODING
        Predefined Charset for 8-Bit encoding.
    • Method Detail

      • toStream

        public static InputStream toStream​(String content,
                                           Charset charset)
        Converts the string of given content to an input stream.
        Parameters:
        content - the string content.
        charset - the charset for conversion.
        Returns:
        the stream (should be closed by invoker).
      • decodeBase64

        public static String decodeBase64​(String encoded)
        Decodes the base64 encoded string to a string.
        Parameters:
        encoded - the base64 encoded value
        Returns:
        a string of the decoded value (UTF-8)