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 Appendable
append
in class Writer
IOException
public Writer append(CharSequence csq) throws IOException
append
in interface Appendable
append
in class Writer
IOException
public Writer append(CharSequence csq, int start, int end) throws IOException
append
in interface Appendable
append
in class Writer
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Writer
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
- If an I/O error occurspublic void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
cbuf
- 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(char[] cbuf) throws IOException
write
in class Writer
IOException
public void write(int c) throws IOException
write
in class Writer
IOException
- If an I/O error occurspublic void write(String str) throws IOException
write
in class Writer
IOException
public void write(String str, int off, int len) throws IOException
write
in class Writer
str
- String to be writtenoff
- Offset from which to start reading characterslen
- Number of characters to be writtenIOException
- If an I/O error occursCopyright © 2002–2020 The Apache Software Foundation. All rights reserved.