public class TeeWriter extends Writer
Constructor and Description |
---|
TeeWriter(Collection<Writer> writers)
Constructor.
|
TeeWriter(Writer... writers)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
TeeWriter |
add(String id,
Writer w,
boolean close)
Same as
add(Writer, boolean) but associates the writer with an identifier so the writer can be retrieved
through getWriter(String) . |
TeeWriter |
add(Writer w,
boolean close)
Adds a writer to this tee writer.
|
void |
close() |
void |
flush() |
Writer |
getWriter(String id)
Returns the writer identified through the
add(String, Writer, boolean) method. |
int |
size()
Returns the number of inner writers in this tee writer.
|
void |
write(char[] cbuf,
int off,
int len) |
public TeeWriter(Writer... writers)
writers
- The list of writers.public TeeWriter(Collection<Writer> writers)
writers
- The list of writers.public TeeWriter add(Writer w, boolean close)
w
- The writer to add to this tee writer.close
- If close()
on this tee writer will not filter to the specified writer.public TeeWriter add(String id, Writer w, boolean close)
add(Writer, boolean)
but associates the writer with an identifier so the writer can be retrieved
through getWriter(String)
.id
- The ID to associate the writer with.w
- The writer to add.close
- Close the specified writer afterwards.public int size()
public Writer getWriter(String id)
add(String, Writer, boolean)
method.id
- The ID associated with the writer.public void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Writer
IOException
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.