public class TestOut extends Object
| Constructor and Description |
|---|
TestOut()
Creates unstance using System.in, System.out and System.err streams.
|
TestOut(InputStream in,
PrintStream out,
PrintStream err)
Constructor.
|
TestOut(InputStream in,
PrintStream out,
PrintStream err,
PrintStream golden)
Constructor.
|
TestOut(InputStream in,
PrintWriter out,
PrintWriter err)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
TestOut |
createErrorOutput()
Creates an output which prints only error messages.
|
void |
flush()
Flushes all output threads.
|
boolean |
getAutoFlushMode()
Says if flush is invoked after each output.
|
PrintWriter |
getErrput()
Returns errput writer.
|
InputStream |
getInput()
Returns input stream.
|
static TestOut |
getNullOutput()
Creates output which does not print any message anywhere.
|
PrintWriter |
getOutput()
Returns output writer.
|
void |
print(String line)
Prints a line into output.
|
void |
printerr(String text)
Prints a error line.
|
void |
printerrln(String line)
Prints a line into error output.
|
void |
println(boolean toOut,
String line)
Prints a line into either output or errput.
|
void |
println(String line)
Prints a line and then terminate the line by writing the line separator string.
|
void |
printStackTrace(Throwable e)
Prints an exception stack trace into error stream.
|
int |
read()
Read one byte from input.
|
String |
readln()
Read a line from input.
|
boolean |
setAutoFlushMode(boolean autoFlushMode)
Specifies either flush is invoked after each output.
|
public TestOut(InputStream in, PrintStream out, PrintStream err)
in - Input streamout - Output streamerr - Errput streampublic TestOut(InputStream in, PrintStream out, PrintStream err, PrintStream golden)
in - Input streamout - Output streamerr - Errput streamgolden - Golgen output streampublic TestOut(InputStream in, PrintWriter out, PrintWriter err)
in - Input streamout - Output streamerr - Errput streampublic TestOut()
public static TestOut getNullOutput()
public boolean setAutoFlushMode(boolean autoFlushMode)
autoFlushMode - If true flush is invoking after each output.getAutoFlushMode()public boolean getAutoFlushMode()
setAutoFlushMode(boolean)public int read()
throws IOException
IOException - todo documentpublic String readln() throws IOException
IOException - todo documentpublic void print(String line)
line - a string to print into output stream.public void println(String line)
line - a string to print into output stream.public void printerrln(String line)
line - a string to print into error output stream.public void println(boolean toOut,
String line)
toOut - If true prints a line into output.line - a string to print.public void printerr(String text)
text - a error text.public void printStackTrace(Throwable e)
e - exceptionpublic InputStream getInput()
public PrintWriter getOutput()
public PrintWriter getErrput()
public TestOut createErrorOutput()
public void flush()
Copyright © 2019. All rights reserved.