Package org.apache.commons.io.output
Class FilterCollectionWriter
java.lang.Object
java.io.Writer
org.apache.commons.io.output.FilterCollectionWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
- Direct Known Subclasses:
ProxyCollectionWriter
Abstract class for writing filtered character streams to a
Collection of writers. This is in contrast to
FilterWriter which is backed by a single Writer.
This abstract class provides default methods that pass all requests to the contained writers. Subclasses should likely override some of these methods.
The class Writer defines method signatures with throws IOException, which in this class are
actually IOExceptionList containing a list of IOIndexedException.
- Since:
- 2.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Collection<Writer> Empty and immutable collection of writers.protected final Collection<Writer> The underlying writers. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFilterCollectionWriter(Writer... writers) Constructs a new filtered collection writer.protectedFilterCollectionWriter(Collection<Writer> writers) Constructs a new filtered collection writer. -
Method Summary
Modifier and TypeMethodDescriptionappend(char c) append(CharSequence csq) append(CharSequence csq, int start, int end) voidclose()voidflush()Flushes the stream.voidwrite(char[] cbuf) voidwrite(char[] cbuf, int off, int len) Writes a portion of an array of characters.voidwrite(int c) Writes a single character.voidvoidWrites a portion of a string.
-
Field Details
-
EMPTY_WRITERS
Empty and immutable collection of writers. -
writers
The underlying writers.
-
-
Constructor Details
-
FilterCollectionWriter
Constructs a new filtered collection writer.- Parameters:
writers- Writers to provide the underlying targets.
-
FilterCollectionWriter
Constructs a new filtered collection writer.- Parameters:
writers- Writers to provide the underlying targets.
-
-
Method Details
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-
flush
Flushes the stream.- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException- If an I/O error occurs
-
write
- Overrides:
writein classWriter- Throws:
IOException
-
write
Writes a portion of an array of characters.- Specified by:
writein classWriter- Parameters:
cbuf- Buffer of characters to be writtenoff- Offset from which to start reading characterslen- Number of characters to be written- Throws:
IOException- If an I/O error occurs
-
write
Writes a single character.- Overrides:
writein classWriter- Throws:
IOException- If an I/O error occurs
-
write
- Overrides:
writein classWriter- Throws:
IOException
-
write
Writes a portion of a string.- Overrides:
writein classWriter- Parameters:
str- String to be writtenoff- Offset from which to start reading characterslen- Number of characters to be written- Throws:
IOException- If an I/O error occurs
-