Class ByteBufferTeePrintStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- java.io.PrintStream
-
- org.eclipse.epsilon.internal.eunit.io.ByteBufferTeePrintStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
public class ByteBufferTeePrintStream extends PrintStream
PrintStream which performs every write twice: once to the original output stream, and another to an internal byte array, so the full output can be later collected and processed transparently. SinceByteArrayOutputStream.close()
andOutputStream.flush()
do not do anything, they are not called from this class.- Version:
- 1.0
- Author:
- Antonio García-Domínguez
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description ByteBufferTeePrintStream(File file)
ByteBufferTeePrintStream(File file, String csn)
ByteBufferTeePrintStream(OutputStream out)
ByteBufferTeePrintStream(OutputStream out, boolean autoFlush)
ByteBufferTeePrintStream(OutputStream out, boolean autoFlush, String encoding)
ByteBufferTeePrintStream(String fileName)
ByteBufferTeePrintStream(String fileName, String csn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getBytes()
Returns the bytes collected by this output stream.void
write(byte[] buf)
void
write(byte[] buf, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.PrintStream
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(OutputStream out)
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(String fileName) throws FileNotFoundException
- Throws:
FileNotFoundException
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(File file) throws FileNotFoundException
- Throws:
FileNotFoundException
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(OutputStream out, boolean autoFlush)
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(String fileName, String csn) throws FileNotFoundException, UnsupportedEncodingException
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(File file, String csn) throws FileNotFoundException, UnsupportedEncodingException
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(OutputStream out, boolean autoFlush, String encoding) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
-
Method Detail
-
write
public void write(int b)
- Overrides:
write
in classPrintStream
-
write
public void write(byte[] buf, int off, int len)
- Overrides:
write
in classPrintStream
-
write
public void write(byte[] buf) throws IOException
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
getBytes
public byte[] getBytes()
Returns the bytes collected by this output stream.
-
-