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.
|
TestOut(InputStream in,
PrintWriter out,
PrintWriter err,
PrintWriter golden)
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.
|
PrintWriter |
getGolden()
Returns golden output 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 |
printErrLine(String line)
Prints a line into error output.
|
void |
printError(String text)
Prints a error line.
|
void |
printGolden(String line)
Prints a line into golden output.
|
void |
printLine(boolean toOut,
String line)
Prints a line into either output or errput.
|
void |
printLine(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.
|
void |
printTrace(String text)
Prints a trace line.
|
int |
read()
Read one byte from input.
|
String |
readLine()
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(InputStream in, PrintWriter out, PrintWriter err, PrintWriter golden)
in
- Input streamout
- Output streamerr
- Errput streamgolden
- Golgen output 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
public String readLine() throws IOException
IOException
public void print(String line)
line
- a string to print into output stream.public void printLine(String line)
line
- a string to print into output stream.public void printGolden(String line)
line
- a string to print into golden output stream.public void printErrLine(String line)
line
- a string to print into error output stream.public void printLine(boolean toOut, String line)
toOut
- If true prints a line into output.line
- a string to print.public void printTrace(String text)
text
- a trace text.public void printError(String text)
text
- a error text.public void printStackTrace(Throwable e)
e
- exceptionpublic InputStream getInput()
public PrintWriter getOutput()
public PrintWriter getErrput()
public PrintWriter getGolden()
public TestOut createErrorOutput()
public void flush()