|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
de.uniba.wiai.lspi.util.console.MemoryOutputStream
public class MemoryOutputStream
This class can be used as OutputStream provided to a PrintStream
that can be used to substitute System.out.
The output is saved in a buffer that can be printed by invocation of
printOutputTo(PrintStream) to the provided PrintStream.
The content of the buffer can be obtained as String by the
getOutput() method.
clearBuffer() empties the buffer and all output, that has been saved
before, is deleted.
| Constructor Summary | |
|---|---|
MemoryOutputStream()
Creates a new instance of MemoryOutputStream |
|
| Method Summary | |
|---|---|
void |
clearBuffer()
Clears the internal buffer of this output stream. |
String |
getOutput()
Get the content of the internal buffer. |
void |
printOutputTo(PrintStream out)
Print the content of the internal buffer to the given PrintStream out. |
void |
write(int b)
Overwritten from OutputStream. |
| Methods inherited from class java.io.OutputStream |
|---|
close, flush, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MemoryOutputStream()
| Method Detail |
|---|
public void clearBuffer()
public void write(int b)
OutputStream. Writes the byte b
to the internal buffer.
write in class OutputStreamb - The byte to write to the internal buffer.public String getOutput()
public void printOutputTo(PrintStream out)
PrintStream out.
out - The PrintStream to print the saved output to.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||