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:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
- Direct Known Subclasses:
CloseShieldOutputStream
,CountingOutputStream
,TaggedOutputStream
,TeeOutputStream
public class ProxyOutputStream extends java.io.FilterOutputStream
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 Constructor Description ProxyOutputStream(java.io.OutputStream proxy)
Constructs a new ProxyOutputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Invokes the delegate'sclose()
method.void
flush()
Invokes the delegate'sflush()
method.void
write(byte[] bts)
Invokes the delegate'swrite(byte[])
method.void
write(byte[] bts, int st, int end)
Invokes the delegate'swrite(byte[])
method.void
write(int idx)
Invokes the delegate'swrite(int)
method.
-
-
-
Method Detail
-
write
public void write(int idx) throws java.io.IOException
Invokes the delegate'swrite(int)
method.- Overrides:
write
in classjava.io.FilterOutputStream
- Parameters:
idx
- the byte to write- Throws:
java.io.IOException
- if an I/O error occurs.
-
write
public void write(byte[] bts) throws java.io.IOException
Invokes the delegate'swrite(byte[])
method.- Overrides:
write
in classjava.io.FilterOutputStream
- Parameters:
bts
- the bytes to write- Throws:
java.io.IOException
- if an I/O error occurs.
-
write
public void write(byte[] bts, int st, int end) throws java.io.IOException
Invokes the delegate'swrite(byte[])
method.- Overrides:
write
in classjava.io.FilterOutputStream
- Parameters:
bts
- the bytes to writest
- The start offsetend
- The number of bytes to write- Throws:
java.io.IOException
- if an I/O error occurs.
-
flush
public void flush() throws java.io.IOException
Invokes the delegate'sflush()
method.- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
- if an I/O error occurs.
-
close
public void close() throws java.io.IOException
Invokes the delegate'sclose()
method.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
- if an I/O error occurs.
-
-