? ProxyCollectionWriter
java.lang.Object
java.io.Writer
org.apache.commons.io.output.FilterCollectionWriter
org.apache.commons.io.output.ProxyCollectionWriter
- ????????:
Closeable
,Flushable
,Appendable
,AutoCloseable
- ??????:
TeeWriter
A Proxy stream collection which acts as expected, that is it passes the method calls on to the proxied streams and
doesn't change which methods are being called. It is an alternative base class to
FilterWriter
and
FilterCollectionWriter
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)
. This is in contrast to ProxyWriter
which is backed by a single
Writer
.- ???????:
- 2.7
-
????
??????? org.apache.commons.io.output.FilterCollectionWriter
EMPTY_WRITERS, writers
-
?????
????????ProxyCollectionWriter
(Writer... writers) Creates a new proxy collection writer.ProxyCollectionWriter
(Collection<Writer> writers) Creates a new proxy collection writer. -
????
??????????protected void
afterWrite
(int n) Invoked by the write methods after the proxied call has returned successfully.append
(char c) Invokes the delegates'append(char)
methods.append
(CharSequence csq) Invokes the delegates'append(CharSequence)
methods.append
(CharSequence csq, int start, int end) Invokes the delegates'append(CharSequence, int, int)
methods.protected void
beforeWrite
(int n) Invoked by the write methods before the call is proxied.void
close()
Invokes the delegate'sclose()
method.void
flush()
Invokes the delegate'sflush()
method.protected void
Handle any IOExceptions thrown.void
write
(char[] cbuf) Invokes the delegate'swrite(char[])
method.void
write
(char[] cbuf, int off, int len) Invokes the delegate'swrite(char[], int, int)
method.void
write
(int c) Invokes the delegate'swrite(int)
method.void
Invokes the delegate'swrite(String)
method.void
Invokes the delegate'swrite(String)
method.??????? java.io.Writer
nullWriter
-
???????
-
ProxyCollectionWriter
Creates a new proxy collection writer.- ??:
writers
- Writers object to provide the underlying targets.
-
ProxyCollectionWriter
Creates a new proxy collection writer.- ??:
writers
- Writers to provide the underlying targets.
-
-
??????
-
afterWrite
Invoked by the write methods after the proxied call has returned successfully. The number of chars written (1 for thewrite(int)
method, buffer length forwrite(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- ??:
IOException
- if the post-processing fails
-
append
Invokes the delegates'append(char)
methods.- ???:
append
????Appendable
- ??:
append
???FilterCollectionWriter
- ??:
c
- The character to write- ??:
- this writer
- ??:
IOException
- if an I/O error occurs.- ???????:
- 2.0
-
append
Invokes the delegates'append(CharSequence)
methods.- ???:
append
????Appendable
- ??:
append
???FilterCollectionWriter
- ??:
csq
- The character sequence to write- ??:
- this writer
- ??:
IOException
- if an I/O error occurs.
-
append
Invokes the delegates'append(CharSequence, int, int)
methods.- ???:
append
????Appendable
- ??:
append
???FilterCollectionWriter
- ??:
csq
- The character sequence to writestart
- The index of the first character to writeend
- The index of the first character to write (exclusive)- ??:
- this writer
- ??:
IOException
- if an I/O error occurs.
-
beforeWrite
Invoked by the write methods before the call is proxied. The number of chars to be written (1 for thewrite(int)
method, buffer length forwrite(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- ??:
IOException
- if the pre-processing fails
-
close
Invokes the delegate'sclose()
method.- ???:
close
????AutoCloseable
- ???:
close
????Closeable
- ??:
close
???FilterCollectionWriter
- ??:
IOException
- if an I/O error occurs.
-
flush
Invokes the delegate'sflush()
method.- ???:
flush
????Flushable
- ??:
flush
???FilterCollectionWriter
- ??:
IOException
- if an I/O error occurs.
-
handleIOException
Handle any IOExceptions thrown.This method provides a point to implement custom exception handling. The default behavior is to re-throw the exception.
- ??:
e
- The IOException thrown- ??:
IOException
- if an I/O error occurs.
-
write
Invokes the delegate'swrite(char[])
method.- ??:
write
???FilterCollectionWriter
- ??:
cbuf
- the characters to write- ??:
IOException
- if an I/O error occurs.
-
write
Invokes the delegate'swrite(char[], int, int)
method.- ??:
write
???FilterCollectionWriter
- ??:
cbuf
- the characters to writeoff
- The start offsetlen
- The number of characters to write- ??:
IOException
- if an I/O error occurs.
-
write
Invokes the delegate'swrite(int)
method.- ??:
write
???FilterCollectionWriter
- ??:
c
- the character to write- ??:
IOException
- if an I/O error occurs.
-
write
Invokes the delegate'swrite(String)
method.- ??:
write
???FilterCollectionWriter
- ??:
str
- the string to write- ??:
IOException
- if an I/O error occurs.
-
write
Invokes the delegate'swrite(String)
method.- ??:
write
???FilterCollectionWriter
- ??:
str
- the string to writeoff
- The start offsetlen
- The number of characters to write- ??:
IOException
- if an I/O error occurs.
-