Package com.sun.javatest.util
Class TextWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.FilterWriter
-
- com.sun.javatest.util.TextWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class TextWriter extends java.io.FilterWriterThis class implements an output stream that has additional methods for printing. It is based on PrintStream except that it does not swallow exceptions.
-
-
Constructor Summary
Constructors Constructor Description TextWriter(java.io.Writer out)Create a new TextWriter, without automatic line flushing.TextWriter(java.io.Writer out, boolean autoFlush)Create a new TextWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidprint(boolean b)Print a boolean.voidprint(char c)Print a character.voidprint(char... s)Print an array of characters.voidprint(double d)Print a double.voidprint(float f)Print a float.voidprint(int i)Print an integer.voidprint(long l)Print a long.voidprint(java.lang.Object obj)Print an object.voidprint(java.lang.String s)Print a string.voidprintln()Finish the line.voidprintln(boolean b)Print a boolean, and then finish the line.voidprintln(char c)Print a character, and then finish the line.voidprintln(char... c)Print an array of characters, and then finish the line.voidprintln(double d)Print a double, and then finish the line.voidprintln(float f)Print a float, and then finish the line.voidprintln(int i)Print an integer, and then finish the line.voidprintln(long l)Print a long, and then finish the line.voidprintln(java.lang.Object obj)Print an Object, and then finish the line.voidprintln(java.lang.String s)Print a String, and then finish the line.
-
-
-
Constructor Detail
-
TextWriter
public TextWriter(java.io.Writer out)
Create a new TextWriter, without automatic line flushing.- Parameters:
out- A character-output stream
-
TextWriter
public TextWriter(java.io.Writer out, boolean autoFlush)Create a new TextWriter.- Parameters:
out- A character-output streamautoFlush- A boolean; if true, the println() methods will flush the output buffer
-
-
Method Detail
-
print
public void print(boolean b) throws java.io.IOExceptionPrint a boolean.- Parameters:
b- the boolean to be printed- Throws:
java.io.IOException- if there is a problem writing to the stream
-
print
public void print(char c) throws java.io.IOExceptionPrint a character.- Parameters:
c- the character to be printed- Throws:
java.io.IOException- if there is a problem writing to the stream
-
print
public void print(int i) throws java.io.IOExceptionPrint an integer.- Parameters:
i- the integer to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
print
public void print(long l) throws java.io.IOExceptionPrint a long.- Parameters:
l- the long to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
print
public void print(float f) throws java.io.IOExceptionPrint a float.- Parameters:
f- the float to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
print
public void print(double d) throws java.io.IOExceptionPrint a double.- Parameters:
d- the double to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
print
public void print(char... s) throws java.io.IOExceptionPrint an array of characters.- Parameters:
s- the array of characters to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
print
public void print(java.lang.String s) throws java.io.IOExceptionPrint a string.- Parameters:
s- the string to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
print
public void print(java.lang.Object obj) throws java.io.IOExceptionPrint an object.- Parameters:
obj- the object to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
println
public void println() throws java.io.IOExceptionFinish the line.- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
println
public void println(boolean b) throws java.io.IOExceptionPrint a boolean, and then finish the line.- Parameters:
b- the boolean to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
println
public void println(char c) throws java.io.IOExceptionPrint a character, and then finish the line.- Parameters:
c- the character to beprinted- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
println
public void println(int i) throws java.io.IOExceptionPrint an integer, and then finish the line.- Parameters:
i- the int to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
println
public void println(long l) throws java.io.IOExceptionPrint a long, and then finish the line.- Parameters:
l- the long to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
println
public void println(float f) throws java.io.IOExceptionPrint a float, and then finish the line.- Parameters:
f- the float to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
println
public void println(double d) throws java.io.IOExceptionPrint a double, and then finish the line.- Parameters:
d- the double to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
println
public void println(char... c) throws java.io.IOExceptionPrint an array of characters, and then finish the line.- Parameters:
c- the array of characters to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
println
public void println(java.lang.String s) throws java.io.IOExceptionPrint a String, and then finish the line.- Parameters:
s- the string to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
println
public void println(java.lang.Object obj) throws java.io.IOExceptionPrint an Object, and then finish the line.- Parameters:
obj- the object to be printed- Throws:
java.io.IOException- if an error occurred while writing to the stream
-
-