|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
java.io.FilterWriter
org.apache.commons.io.output.ProxyWriter
public class ProxyWriter
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 FilterWriter to increase reusability, because FilterWriter changes the methods being called, such as write(char[]) to write(char[], int, int) and write(String) to write(String, int, int).
Field Summary |
---|
Fields inherited from class java.io.FilterWriter |
---|
out |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
ProxyWriter(java.io.Writer proxy)
Constructs a new ProxyWriter. |
Method Summary | |
---|---|
protected void |
afterWrite(int n)
Invoked by the write methods after the proxied call has returned successfully. |
java.io.Writer |
append(char c)
Invokes the delegate's append(char) method. |
java.io.Writer |
append(java.lang.CharSequence csq)
Invokes the delegate's append(CharSequence) method. |
java.io.Writer |
append(java.lang.CharSequence csq,
int start,
int end)
Invokes the delegate's append(CharSequence, int, int) method. |
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(char[] chr)
Invokes the delegate's write(char[]) method. |
void |
write(char[] chr,
int st,
int len)
Invokes the delegate's write(char[], int, int) method. |
void |
write(int idx)
Invokes the delegate's write(int) method. |
void |
write(java.lang.String str)
Invokes the delegate's write(String) method. |
void |
write(java.lang.String str,
int st,
int len)
Invokes the delegate's write(String) method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProxyWriter(java.io.Writer proxy)
proxy
- the Writer to delegate toMethod Detail |
---|
public java.io.Writer append(char c) throws java.io.IOException
append(char)
method.
append
in interface java.lang.Appendable
append
in class java.io.Writer
c
- The character to write
java.io.IOException
- if an I/O error occurspublic java.io.Writer append(java.lang.CharSequence csq, int start, int end) throws java.io.IOException
append(CharSequence, int, int)
method.
append
in interface java.lang.Appendable
append
in class java.io.Writer
csq
- The character sequence to writestart
- The index of the first character to writeend
- The index of the first character to write (exclusive)
java.io.IOException
- if an I/O error occurspublic java.io.Writer append(java.lang.CharSequence csq) throws java.io.IOException
append(CharSequence)
method.
append
in interface java.lang.Appendable
append
in class java.io.Writer
csq
- The character sequence to write
java.io.IOException
- if an I/O error occurspublic void write(int idx) throws java.io.IOException
write(int)
method.
write
in class java.io.FilterWriter
idx
- the character to write
java.io.IOException
- if an I/O error occurspublic void write(char[] chr) throws java.io.IOException
write(char[])
method.
write
in class java.io.Writer
chr
- the characters to write
java.io.IOException
- if an I/O error occurspublic void write(char[] chr, int st, int len) throws java.io.IOException
write(char[], int, int)
method.
write
in class java.io.FilterWriter
chr
- the characters to writest
- The start offsetlen
- The number of characters to write
java.io.IOException
- if an I/O error occurspublic void write(java.lang.String str) throws java.io.IOException
write(String)
method.
write
in class java.io.Writer
str
- the string to write
java.io.IOException
- if an I/O error occurspublic void write(java.lang.String str, int st, int len) throws java.io.IOException
write(String)
method.
write
in class java.io.FilterWriter
str
- the string to writest
- The start offsetlen
- The number of characters to write
java.io.IOException
- if an I/O error occurspublic void flush() throws java.io.IOException
flush()
method.
flush
in interface java.io.Flushable
flush
in class java.io.FilterWriter
java.io.IOException
- if an I/O error occurspublic void close() throws java.io.IOException
close()
method.
close
in interface java.io.Closeable
close
in class java.io.FilterWriter
java.io.IOException
- if an I/O error occursprotected void beforeWrite(int n) throws java.io.IOException
write(int)
method, buffer
length for write(char[])
, 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 chars to be written
java.io.IOException
- if the pre-processing failsprotected void afterWrite(int n) throws java.io.IOException
write(int)
method, buffer length for write(char[])
,
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 chars written
java.io.IOException
- if the post-processing failsprotected 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 |