Class ByteBufferTeePrintStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- java.io.PrintStream
-
- org.eclipse.epsilon.internal.eunit.io.ByteBufferTeePrintStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.Appendable
,java.lang.AutoCloseable
public class ByteBufferTeePrintStream extends java.io.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
-
-
Constructor Summary
Constructors Constructor Description ByteBufferTeePrintStream(java.io.File file)
ByteBufferTeePrintStream(java.io.File file, java.lang.String csn)
ByteBufferTeePrintStream(java.io.OutputStream out)
ByteBufferTeePrintStream(java.io.OutputStream out, boolean autoFlush)
ByteBufferTeePrintStream(java.io.OutputStream out, boolean autoFlush, java.lang.String encoding)
ByteBufferTeePrintStream(java.lang.String fileName)
ByteBufferTeePrintStream(java.lang.String fileName, java.lang.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
-
-
-
-
Constructor Detail
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(java.io.OutputStream out)
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(java.lang.String fileName) throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(java.io.File file) throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(java.io.OutputStream out, boolean autoFlush)
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(java.lang.String fileName, java.lang.String csn) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException
- Throws:
java.io.FileNotFoundException
java.io.UnsupportedEncodingException
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(java.io.File file, java.lang.String csn) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException
- Throws:
java.io.FileNotFoundException
java.io.UnsupportedEncodingException
-
ByteBufferTeePrintStream
public ByteBufferTeePrintStream(java.io.OutputStream out, boolean autoFlush, java.lang.String encoding) throws java.io.UnsupportedEncodingException
- Throws:
java.io.UnsupportedEncodingException
-
-
Method Detail
-
write
public void write(int b)
- Overrides:
write
in classjava.io.PrintStream
-
write
public void write(byte[] buf, int off, int len)
- Overrides:
write
in classjava.io.PrintStream
-
write
public void write(byte[] buf) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
getBytes
public byte[] getBytes()
Returns the bytes collected by this output stream.
-
-