Class EncodingUtil

java.lang.Object
com.icegreen.greenmail.util.EncodingUtil

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

    • 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:
    • CHARSET_EIGHT_BIT_ENCODING

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

    • 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).
    • toString

      public static String toString(InputStream is, Charset charset)
    • 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)