public static final class CapturedPrintStream.MemoryCapturedPrintStream extends CapturedPrintStream
PrintStream to capture to a memory-based buffer.
The captured stream is available by calling getReader().
UTF-8 is used for encoding and decoding the stream content.CapturedPrintStream.getInstance()CapturedPrintStream.FileCapturedPrintStream, CapturedPrintStream.MemoryCapturedPrintStream| Modifier and Type | Method and Description |
|---|---|
java.io.BufferedReader |
getReader()
Gets a
BufferedReader over the bytes written to this PrintStream. |
void |
reset()
Discards the captured output.
|
byte[] |
toByteArray()
Gets a copy of the content of this stream as a byte array.
|
append, append, append, checkError, close, flush, format, format, getInstance, getInstance, getInstance, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, write, write, writepublic java.io.BufferedReader getReader()
CapturedPrintStreamBufferedReader over the bytes written to this PrintStream.
The content of this stream is not altered by this method.getReader in class CapturedPrintStreamBufferedReader over the bytes written to this streamCapturedPrintStream.reset()public void reset()
CapturedPrintStreamreset in class CapturedPrintStreampublic byte[] toByteArray()
CapturedPrintStreamtoByteArray in class CapturedPrintStreamCapturedPrintStream.reset()