bb.util
Class JUnitExecutor.BufferWithEcho
java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
bb.util.JUnitExecutor.BufferWithEcho
- All Implemented Interfaces:
- Closeable, Flushable
- Enclosing class:
- JUnitExecutor
private static class JUnitExecutor.BufferWithEcho
- extends ByteArrayOutputStream
Modifies superclass to echo the last line stored in the buffer to the console
after byte(s) are written to it.
This gives the user some amount of feedback as to what is going on.
The console output is continuously overwritten on the same line in order to reduce clutter,
just like the ConsoleUtil
class does.
It is critical that this stream be closed when its use is over,
since the close
method has been overridden to erase the console line
that it has been writing to.
This class is multithread safe: every public method is synchronized.
Method Summary |
void |
close()
Overrides superclass method to additionally erase the console line that this instance has been writing to. |
private void |
echoLastLine()
|
private void |
eraseLine()
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
private void |
writeLine(String line)
|
stdStreamOriginal
private final PrintStream stdStreamOriginal
JUnitExecutor.BufferWithEcho
private JUnitExecutor.BufferWithEcho(PrintStream stdStreamOriginal)
write
public void write(int b)
- Overrides:
write
in class ByteArrayOutputStream
write
public void write(byte[] b,
int off,
int len)
- Overrides:
write
in class ByteArrayOutputStream
echoLastLine
private void echoLastLine()
eraseLine
private void eraseLine()
writeLine
private void writeLine(String line)
close
public void close()
throws IOException
- Overrides superclass method to additionally erase the console line that this instance has been writing to.
- Specified by:
close
in interface Closeable
- Overrides:
close
in class ByteArrayOutputStream
- Throws:
IOException