public class FilterCollectionWriter extends Writer
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.
| Modifier and Type | Field and Description |
|---|---|
protected Collection<Writer> |
EMPTY_WRITERS
Empty and immutable collection of writers.
|
protected Collection<Writer> |
writers
The underlying writers.
|
| Modifier | Constructor and Description |
|---|---|
protected |
FilterCollectionWriter(Collection<Writer> writers)
Creates a new filtered collection writer.
|
protected |
FilterCollectionWriter(Writer... writers)
Creates a new filtered collection writer.
|
| Modifier and Type | Method and Description |
|---|---|
Writer |
append(char c) |
Writer |
append(CharSequence csq) |
Writer |
append(CharSequence csq,
int start,
int end) |
void |
close() |
void |
flush()
Flushes the stream.
|
void |
write(char[] cbuf) |
void |
write(char[] cbuf,
int off,
int len)
Writes a portion of an array of characters.
|
void |
write(int c)
Writes a single character.
|
void |
write(String str) |
void |
write(String str,
int off,
int len)
Writes a portion of a string.
|
protected final Collection<Writer> EMPTY_WRITERS
protected final Collection<Writer> writers
protected FilterCollectionWriter(Collection<Writer> writers)
writers - Writers to provide the underlying targets.protected FilterCollectionWriter(Writer... writers)
writers - Writers to provide the underlying targets.public Writer append(char c) throws IOException
append in interface Appendableappend in class WriterIOExceptionpublic Writer append(CharSequence csq) throws IOException
append in interface Appendableappend in class WriterIOExceptionpublic Writer append(CharSequence csq, int start, int end) throws IOException
append in interface Appendableappend in class WriterIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class WriterIOException - If an I/O error occurspublic void write(char[] cbuf)
throws IOException
write in class WriterIOExceptionpublic void write(char[] cbuf,
int off,
int len)
throws IOException
write in class Writercbuf - Buffer of characters to be writtenoff - Offset from which to start reading characterslen - Number of characters to be writtenIOException - If an I/O error occurspublic void write(int c)
throws IOException
write in class WriterIOException - If an I/O error occurspublic void write(String str) throws IOException
write in class WriterIOExceptionpublic void write(String str, int off, int len) throws IOException
write in class Writerstr - String to be writtenoff - Offset from which to start reading characterslen - Number of characters to be writtenIOException - If an I/O error occursCopyright © 2002–2021 The Apache Software Foundation. All rights reserved.