Class DelegatingWriter
java.lang.Object
java.io.Writer
nl.talsmasoftware.umldoclet.rendering.writers.DelegatingWriter
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
- Direct Known Subclasses:
StringBufferingWriter
Base implementation that delegates writing to one or more delegate writers.
- Author:
- Sjoerd Talsma
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Delegates the close operation to all delegates and merges any occurred exceptions into a singleIOException
.void
flush()
Delegates the flush operation to all delegates and merges any occurred exceptions into a singleIOException
.toString()
void
write
(char[] cbuf, int off, int len) Delegates the write operation to all delegates and merges any occurred exceptions into a singleIOException
.
-
Field Details
-
delegates
The list ofdelegate writers
to write to.
-
-
Constructor Details
-
DelegatingWriter
Constructor. Creates a new writer that writes to all provided delegates when written to.- Parameters:
delegates
- The delegates to write to.
-
-
Method Details
-
write
Delegates the write operation to all delegates and merges any occurred exceptions into a singleIOException
.- Specified by:
write
in classWriter
- Parameters:
cbuf
- The buffer containing the characters to be written.off
- The offset index to write from.len
- The number of characters to write.- Throws:
IOException
- in case at least one of the delegate writers threw an exception while writing. Please note: It is very well possible that other delegates were succesfully written.
-
flush
Delegates the flush operation to all delegates and merges any occurred exceptions into a singleIOException
.- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classWriter
- Throws:
IOException
- in case at least one of the delegate writers threw an exception while flushing.
-
close
Delegates the close operation to all delegates and merges any occurred exceptions into a singleIOException
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classWriter
- Throws:
IOException
- in case at least one of the delegate writers threw an exception while closing. Please note: Attempts are made to close all delegates.
-
toString
-