Class TextStream

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class TextStream extends FilterOutputStream
This class implements an output stream that has additional methods for printing. It is similar to java.io.PrintStream except that it does not swallow exceptions.
  • Constructor Details

    • TextStream

      public TextStream(OutputStream out)
      Creates a new TextStream.
      Parameters:
      out - the output stream
    • TextStream

      public TextStream(OutputStream out, boolean autoflush)
      Creates a new TextStream.
      Parameters:
      out - the output stream
      autoflush - set to true to flush the stream after each newline character is written
  • Method Details

    • print

      public void print(String s) throws IOException
      Prints a String.
      Parameters:
      s - the String to be printed
      Throws:
      IOException - if there is a problem writing to the stream
    • println

      public void println() throws IOException
      Prints a newline.
      Throws:
      IOException - if there is a problem writing to the stream
    • println

      public void println(String s) throws IOException
      Prints a string followed by a newline.
      Parameters:
      s - the String to be printed
      Throws:
      IOException - if there is a problem writing to the stream