Package org.apache.commons.io.output
Class ProxyOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.commons.io.output.ProxyOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Direct Known Subclasses:
CloseShieldOutputStream,CountingOutputStream,TaggedOutputStream,TeeOutputStream
A Proxy stream which acts as expected, that is it passes the method
calls on to the proxied stream and doesn't change which methods are
being called. It is an alternative base class to FilterOutputStream
to increase reusability.
See the protected methods for ways in which a subclass can easily decorate a stream with custom pre-, post- or error processing functionality.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Invokes the delegate'sclose()method.voidflush()Invokes the delegate'sflush()method.voidwrite(byte[] bts) Invokes the delegate'swrite(byte[])method.voidwrite(byte[] bts, int st, int end) Invokes the delegate'swrite(byte[])method.voidwrite(int idx) Invokes the delegate'swrite(int)method.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
ProxyOutputStream
Constructs a new ProxyOutputStream.- Parameters:
proxy- the OutputStream to delegate to
-
-
Method Details
-
close
Invokes the delegate'sclose()method.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException- if an I/O error occurs.
-
flush
Invokes the delegate'sflush()method.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classFilterOutputStream- Throws:
IOException- if an I/O error occurs.
-
write
Invokes the delegate'swrite(byte[])method.- Overrides:
writein classFilterOutputStream- Parameters:
bts- the bytes to write- Throws:
IOException- if an I/O error occurs.
-
write
Invokes the delegate'swrite(byte[])method.- Overrides:
writein classFilterOutputStream- Parameters:
bts- the bytes to writest- The start offsetend- The number of bytes to write- Throws:
IOException- if an I/O error occurs.
-
write
Invokes the delegate'swrite(int)method.- Overrides:
writein classFilterOutputStream- Parameters:
idx- the byte to write- Throws:
IOException- if an I/O error occurs.
-