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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Delegates the close operation to all delegates and merges any occurred exceptions into a singleIOException.voidflush()Delegates the flush operation to all delegates and merges any occurred exceptions into a singleIOException.toString()voidwrite(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 writersto 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:
writein 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:
flushin interfaceFlushable- Specified by:
flushin 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein 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
-