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 TypeMethodDescriptionvoid
close()
void
flush()
void
replaceOutputStream
(OutputStream underlying) void
write
(byte[] b) void
write
(byte[] b, int off, int len) void
write
(int i) Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
ProxyOutputStream
public ProxyOutputStream()
-
-
Method Details
-
replaceOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-