|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
org.apache.commons.io.output.ProxyOutputStream
public class ProxyOutputStream
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.
| Field Summary |
|---|
| Fields inherited from class java.io.FilterOutputStream |
|---|
out |
| Constructor Summary | |
|---|---|
ProxyOutputStream(java.io.OutputStream proxy)
Constructs a new ProxyOutputStream. |
|
| Method Summary | |
|---|---|
protected void |
afterWrite(int n)
Invoked by the write methods after the proxied call has returned successfully. |
protected void |
beforeWrite(int n)
Invoked by the write methods before the call is proxied. |
void |
close()
Invokes the delegate's close() method. |
void |
flush()
Invokes the delegate's flush() method. |
protected void |
handleIOException(java.io.IOException e)
Handle any IOExceptions thrown. |
void |
write(byte[] bts)
Invokes the delegate's write(byte[]) method. |
void |
write(byte[] bts,
int st,
int end)
Invokes the delegate's write(byte[]) method. |
void |
write(int idx)
Invokes the delegate's write(int) method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ProxyOutputStream(java.io.OutputStream proxy)
proxy - the OutputStream to delegate to| Method Detail |
|---|
public void write(int idx)
throws java.io.IOException
write(int) method.
write in class java.io.FilterOutputStreamidx - the byte to write
java.io.IOException - if an I/O error occurs
public void write(byte[] bts)
throws java.io.IOException
write(byte[]) method.
write in class java.io.FilterOutputStreambts - the bytes to write
java.io.IOException - if an I/O error occurs
public void write(byte[] bts,
int st,
int end)
throws java.io.IOException
write(byte[]) method.
write in class java.io.FilterOutputStreambts - the bytes to writest - The start offsetend - The number of bytes to write
java.io.IOException - if an I/O error occurs
public void flush()
throws java.io.IOException
flush() method.
flush in interface java.io.Flushableflush in class java.io.FilterOutputStreamjava.io.IOException - if an I/O error occurs
public void close()
throws java.io.IOException
close() method.
close in interface java.io.Closeableclose in class java.io.FilterOutputStreamjava.io.IOException - if an I/O error occurs
protected void beforeWrite(int n)
throws java.io.IOException
write(int) method, buffer
length for write(byte[]), etc.) is given as an argument.
Subclasses can override this method to add common pre-processing functionality without having to override all the write methods. The default implementation does nothing.
n - number of bytes to be written
java.io.IOException - if the pre-processing fails
protected void afterWrite(int n)
throws java.io.IOException
write(int) method, buffer length for write(byte[]),
etc.) is given as an argument.
Subclasses can override this method to add common post-processing functionality without having to override all the write methods. The default implementation does nothing.
n - number of bytes written
java.io.IOException - if the post-processing fails
protected void handleIOException(java.io.IOException e)
throws java.io.IOException
This method provides a point to implement custom exception handling. The default behaviour is to re-throw the exception.
e - The IOException thrown
java.io.IOException - if an I/O error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||