Package cx.ath.matthew.io
Class TeeOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
cx.ath.matthew.io.TeeOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
Class to copy a stream to another stream or file as it is being sent through a stream pipe
E.g.
PrintWriter r = new PrintWriter(new TeeOutputStream(new FileOutputStream("file"), new File("otherfile")));
-
Constructor Summary
ConstructorsConstructorDescriptionTeeOutputStream
(OutputStream os, File f) Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.TeeOutputStream
(OutputStream os, File f, boolean append) Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.TeeOutputStream
(OutputStream os, OutputStream tos) Create a new TeeOutputStream on the given OutputStream and copy the stream to the other OuputStream.TeeOutputStream
(OutputStream os, String f) Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.TeeOutputStream
(OutputStream os, String f, boolean append) Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File. -
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
TeeOutputStream
Create a new TeeOutputStream on the given OutputStream and copy the stream to the other OuputStream.- Parameters:
os
- Writes to this OutputStreamtos
- Write to this OutputStream- Throws:
IOException
-
TeeOutputStream
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.- Parameters:
os
- Writes to this OutputStreamf
- Write to this Fileappend
- Append to file not overwrite- Throws:
IOException
-
TeeOutputStream
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.- Parameters:
os
- Writes to this OutputStreamf
- Write to this File- Throws:
IOException
-
TeeOutputStream
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.- Parameters:
os
- Writes to this OutputStreamf
- Write to this Fileappend
- Append to file not overwrite- Throws:
IOException
-
TeeOutputStream
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.- Parameters:
os
- Writes to this OutputStreamf
- Write to this File- Throws:
IOException
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classFilterOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
finalize
public void finalize()
-