Package sop.util
Class ProxyOutputStream
java.lang.Object
java.io.OutputStream
sop.util.ProxyOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
OutputStream that buffers data being written into it, until its underlying output stream is being replaced.
At that point, first all the buffered data is being written to the underlying stream, followed by any successive
data that may get written to the ProxyOutputStream.
This class is useful if we need to provide an OutputStream at one point in time when the final
target output stream is not yet known.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()voidreplaceOutputStream(OutputStream underlying) voidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int i) Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
ProxyOutputStream
public ProxyOutputStream()
-
-
Method Details
-
replaceOutputStream
- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-