Class EncodedPrintStream

All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class EncodedPrintStream extends PrintStream
Allow a PrintStream to specify an encoding.

This functionality is provided out of the box by the Java 1.4 version of PrintStream. This class is strictly for backwards compatibility.

  • Field Details

    • encoding

      private final String encoding
  • Constructor Details

    • EncodedPrintStream

      public EncodedPrintStream(OutputStream out, String encoding) throws UnsupportedEncodingException
      Constructor allows specifying a character encoding.

      Does not automatically flush the underlying output stream.

      Parameters:
      out - The underlying output stream.
      encoding - String representation of a character encoding.
      Throws:
      UnsupportedEncodingException - If the character encoding is not supported by the JVM.
    • EncodedPrintStream

      public EncodedPrintStream(OutputStream out, boolean autoFlush, String encoding) throws UnsupportedEncodingException
      Constructor allows specifying a character encoding.
      Parameters:
      out - The underlying output stream.
      autoFlush - See PrintStream()
      encoding - String representation of a character encoding.
      Throws:
      UnsupportedEncodingException - If the character encoding is not supported by the JVM.
  • Method Details