Class MirrorPrintStream
- java.lang.Object
 - 
- java.io.OutputStream
 - 
- java.io.FilterOutputStream
 - 
- java.io.PrintStream
 - 
- org.eclipse.epsilon.common.dt.console.MirrorPrintStream
 
 
 
 
 
- 
- All Implemented Interfaces:
 java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class MirrorPrintStream extends java.io.PrintStreamMirrorPrintStream is a PrintStream that mirrors all print/write operations into a file. Only the write(), check() and close() methods need overriding given that any of the print() and println() methods must go through these.- Since:
 - 1.6
 - Author:
 - Horacio Hoyos Rodriguez
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringfileNameThe file name.protected java.io.PrintStreamfileStreamThe file stream. 
- 
Constructor Summary
Constructors Constructor Description MirrorPrintStream(java.io.OutputStream os)Instantiates a MirrorPrintStream with autoflush.MirrorPrintStream(java.io.OutputStream os, boolean flush) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckError()Return true if either stream has an error.protected voidclearError()Clears the internal error state of this stream.voidclose()voiddisableMirror()Disable the mirror operation.voidflush()voidmirrorToFile(java.lang.String fileName)Enable mirroring to the given file.voidmirrorToFile(java.lang.String fileName, boolean append)Enable mirroring to the given file.protected voidsetError()Sets the error state of the stream totrue.voidwrite(byte[] x, int o, int l)voidwrite(int x) 
 - 
 
- 
- 
Method Detail
- 
checkError
public boolean checkError()
Return true if either stream has an error.- Overrides:
 checkErrorin classjava.io.PrintStream
 
- 
write
public void write(int x)
- Overrides:
 writein classjava.io.PrintStream
 
- 
write
public void write(byte[] x, int o, int l)- Overrides:
 writein classjava.io.PrintStream
 
- 
close
public void close()
- Specified by:
 closein interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable- Overrides:
 closein classjava.io.PrintStream
 
- 
flush
public void flush()
- Specified by:
 flushin interfacejava.io.Flushable- Overrides:
 flushin classjava.io.PrintStream
 
- 
mirrorToFile
public void mirrorToFile(java.lang.String fileName)
Enable mirroring to the given file. If there is an error the MirrorPrintStream will be flagged as having an error. By default bytes will be written to the beginning of the file- Parameters:
 fileName- The name of the file to direct output.- See Also:
 mirrorToFile(String, boolean)
 
- 
mirrorToFile
public void mirrorToFile(java.lang.String fileName, boolean append)Enable mirroring to the given file. If there is an error the MirrorPrintStream will be flagged as having an error.- Parameters:
 fileName- The name of the file to direct output.append- if true, then bytes will be written to the end of the file rather than the beginning
 
- 
disableMirror
public void disableMirror()
Disable the mirror operation. 
- 
setError
protected void setError()
Sets the error state of the stream totrue.This method will cause subsequent invocations of
checkError()to return true untilclearError()is invoked.- Overrides:
 setErrorin classjava.io.PrintStream
 
- 
clearError
protected void clearError()
Clears the internal error state of this stream.This method will cause subsequent invocations of
checkError()to return false until another write operation fails and invokessetError().- Overrides:
 clearErrorin classjava.io.PrintStream
 
 - 
 
 -