Class TextWriter

java.lang.Object
java.io.Writer
java.io.FilterWriter
com.sun.javatest.util.TextWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class TextWriter extends FilterWriter
This class implements an output stream that has additional methods for printing. It is based on PrintStream except that it does not swallow exceptions.
  • Constructor Details

    • TextWriter

      public TextWriter(Writer out)
      Create a new TextWriter, without automatic line flushing.
      Parameters:
      out - A character-output stream
    • TextWriter

      public TextWriter(Writer out, boolean autoFlush)
      Create a new TextWriter.
      Parameters:
      out - A character-output stream
      autoFlush - A boolean; if true, the println() methods will flush the output buffer
  • Method Details

    • print

      public void print(boolean b) throws IOException
      Print a boolean.
      Parameters:
      b - the boolean to be printed
      Throws:
      IOException - if there is a problem writing to the stream
    • print

      public void print(char c) throws IOException
      Print a character.
      Parameters:
      c - the character to be printed
      Throws:
      IOException - if there is a problem writing to the stream
    • print

      public void print(int i) throws IOException
      Print an integer.
      Parameters:
      i - the integer to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • print

      public void print(long l) throws IOException
      Print a long.
      Parameters:
      l - the long to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • print

      public void print(float f) throws IOException
      Print a float.
      Parameters:
      f - the float to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • print

      public void print(double d) throws IOException
      Print a double.
      Parameters:
      d - the double to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • print

      public void print(char... s) throws IOException
      Print an array of characters.
      Parameters:
      s - the array of characters to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • print

      public void print(String s) throws IOException
      Print a string.
      Parameters:
      s - the string to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • print

      public void print(Object obj) throws IOException
      Print an object.
      Parameters:
      obj - the object to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • println

      public void println() throws IOException
      Finish the line.
      Throws:
      IOException - if an error occurred while writing to the stream
    • println

      public void println(boolean b) throws IOException
      Print a boolean, and then finish the line.
      Parameters:
      b - the boolean to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • println

      public void println(char c) throws IOException
      Print a character, and then finish the line.
      Parameters:
      c - the character to beprinted
      Throws:
      IOException - if an error occurred while writing to the stream
    • println

      public void println(int i) throws IOException
      Print an integer, and then finish the line.
      Parameters:
      i - the int to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • println

      public void println(long l) throws IOException
      Print a long, and then finish the line.
      Parameters:
      l - the long to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • println

      public void println(float f) throws IOException
      Print a float, and then finish the line.
      Parameters:
      f - the float to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • println

      public void println(double d) throws IOException
      Print a double, and then finish the line.
      Parameters:
      d - the double to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • println

      public void println(char... c) throws IOException
      Print an array of characters, and then finish the line.
      Parameters:
      c - the array of characters to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • println

      public void println(String s) throws IOException
      Print a String, and then finish the line.
      Parameters:
      s - the string to be printed
      Throws:
      IOException - if an error occurred while writing to the stream
    • println

      public void println(Object obj) throws IOException
      Print an Object, and then finish the line.
      Parameters:
      obj - the object to be printed
      Throws:
      IOException - if an error occurred while writing to the stream