public class ProxyWriter extends FilterWriter
out
Constructor and Description |
---|
ProxyWriter(Writer proxy)
Constructs a new ProxyWriter.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterWrite(int n)
Invoked by the write methods after the proxied call has returned
successfully.
|
Writer |
append(char c)
Invokes the delegate's
append(char) method. |
Writer |
append(CharSequence csq)
Invokes the delegate's
append(CharSequence) method. |
Writer |
append(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(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(String str)
Invokes the delegate's
write(String) method. |
void |
write(String str,
int st,
int len)
Invokes the delegate's
write(String) method. |
public ProxyWriter(Writer proxy)
proxy
- the Writer to delegate topublic Writer append(char c) throws IOException
append(char)
method.append
in interface Appendable
append
in class Writer
c
- The character to writeIOException
- if an I/O error occurspublic Writer append(CharSequence csq, int start, int end) throws IOException
append(CharSequence, int, int)
method.append
in interface Appendable
append
in class Writer
csq
- The character sequence to writestart
- The index of the first character to writeend
- The index of the first character to write (exclusive)IOException
- if an I/O error occurspublic Writer append(CharSequence csq) throws IOException
append(CharSequence)
method.append
in interface Appendable
append
in class Writer
csq
- The character sequence to writeIOException
- if an I/O error occurspublic void write(int idx) throws IOException
write(int)
method.write
in class FilterWriter
idx
- the character to writeIOException
- if an I/O error occurspublic void write(char[] chr) throws IOException
write(char[])
method.write
in class Writer
chr
- the characters to writeIOException
- if an I/O error occurspublic void write(char[] chr, int st, int len) throws IOException
write(char[], int, int)
method.write
in class FilterWriter
chr
- the characters to writest
- The start offsetlen
- The number of characters to writeIOException
- if an I/O error occurspublic void write(String str) throws IOException
write(String)
method.write
in class Writer
str
- the string to writeIOException
- if an I/O error occurspublic void write(String str, int st, int len) throws IOException
write(String)
method.write
in class FilterWriter
str
- the string to writest
- The start offsetlen
- The number of characters to writeIOException
- if an I/O error occurspublic void flush() throws IOException
flush()
method.flush
in interface Flushable
flush
in class FilterWriter
IOException
- if an I/O error occurspublic void close() throws IOException
close()
method.close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterWriter
IOException
- if an I/O error occursprotected void beforeWrite(int n) throws 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 writtenIOException
- if the pre-processing failsprotected void afterWrite(int n) throws 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 writtenIOException
- if the post-processing failsprotected void handleIOException(IOException e) throws IOException
This method provides a point to implement custom exception handling. The default behaviour is to re-throw the exception.
e
- The IOException thrownIOException
- if an I/O error occursCopyright © 2002–2016 The Apache Software Foundation. All rights reserved.