Package org.apache.commons.io.output
Class ProxyCollectionWriter
java.lang.Object
java.io.Writer
org.apache.commons.io.output.FilterCollectionWriter
org.apache.commons.io.output.ProxyCollectionWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
- Direct Known Subclasses:
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.- Since:
- 2.7
-
Constructor Summary
ConstructorsConstructorDescriptionProxyCollectionWriter(Writer... writers) Constructs a new proxy collection writer.ProxyCollectionWriter(Collection<Writer> writers) Constructs a new proxy collection writer. -
Method Summary
Modifier and TypeMethodDescriptionappend(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.voidclose()Invokes the delegate'sclose()method.voidflush()Invokes the delegate'sflush()method.voidwrite(char[] cbuf) Invokes the delegate'swrite(char[])method.voidwrite(char[] cbuf, int off, int len) Invokes the delegate'swrite(char[], int, int)method.voidwrite(int c) Invokes the delegate'swrite(int)method.voidInvokes the delegate'swrite(String)method.voidInvokes the delegate'swrite(String)method.Methods inherited from class java.io.Writer
nullWriter
-
Constructor Details
-
ProxyCollectionWriter
Constructs a new proxy collection writer.- Parameters:
writers- Writers object to provide the underlying targets.
-
ProxyCollectionWriter
Constructs a new proxy collection writer.- Parameters:
writers- Writers to provide the underlying targets.
-
-
Method Details
-
append
Invokes the delegates'append(char)methods.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classFilterCollectionWriter- Parameters:
c- The character to write- Returns:
- this writer
- Throws:
IOException- if an I/O error occurs.- Since:
- 2.0
-
append
Invokes the delegates'append(CharSequence)methods.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classFilterCollectionWriter- Parameters:
csq- The character sequence to write- Returns:
- this writer
- Throws:
IOException- if an I/O error occurs.
-
append
Invokes the delegates'append(CharSequence, int, int)methods.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classFilterCollectionWriter- Parameters:
csq- The character sequence to writestart- The index of the first character to writeend- The index of the first character to write (exclusive)- Returns:
- this writer
- Throws:
IOException- if an I/O error occurs.
-
close
Invokes the delegate'sclose()method.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterCollectionWriter- Throws:
IOException- if an I/O error occurs.
-
flush
Invokes the delegate'sflush()method.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classFilterCollectionWriter- Throws:
IOException- if an I/O error occurs.
-
write
Invokes the delegate'swrite(char[])method.- Overrides:
writein classFilterCollectionWriter- Parameters:
cbuf- the characters to write- Throws:
IOException- if an I/O error occurs.
-
write
Invokes the delegate'swrite(char[], int, int)method.- Overrides:
writein classFilterCollectionWriter- Parameters:
cbuf- the characters to writeoff- The start offsetlen- The number of characters to write- Throws:
IOException- if an I/O error occurs.
-
write
Invokes the delegate'swrite(int)method.- Overrides:
writein classFilterCollectionWriter- Parameters:
c- the character to write- Throws:
IOException- if an I/O error occurs.
-
write
Invokes the delegate'swrite(String)method.- Overrides:
writein classFilterCollectionWriter- Parameters:
str- the string to write- Throws:
IOException- if an I/O error occurs.
-
write
Invokes the delegate'swrite(String)method.- Overrides:
writein classFilterCollectionWriter- Parameters:
str- the string to writeoff- The start offsetlen- The number of characters to write- Throws:
IOException- if an I/O error occurs.
-