public class WriterRouterErrors extends Object
ElementWriter
s to the file system, or creates new sub-directories for
writng data to.
This class is similar to Writer
but:
These operations occur in association with the currently bound output manager.
The ElementWriterSupplier
interface is used so as to avoid object-creation if an
operation isn't actually written.
Note that a ElementWriter
may write more than one file for a given element.
Modifier and Type | Field and Description |
---|---|
static int |
NUMBER_ELEMENTS_WRITTEN_ERRORED |
Constructor and Description |
---|
WriterRouterErrors(Writer delegate,
ErrorReporter errorReporter) |
Modifier and Type | Method and Description |
---|---|
Optional<Path> |
createFilenameForWriting(String outputName,
String extension)
The path to write a particular output to.
|
Optional<Outputter> |
createSubdirectory(String outputName,
boolean inheritOutputRulesAndRecording)
Maybe creates a subdirectory for writing to.
|
<T> void |
write(String outputName,
ElementWriterSupplier<T> elementWriter,
ElementSupplier<T> element)
Writes an element using an
ElementWriter to the current directory. |
<T> void |
writeWithIndex(IndexableOutputNameStyle outputNameStyle,
ElementWriterSupplier<T> elementWriter,
ElementSupplier<T> element,
String index)
Writes an indexed-element using an
ElementWriter in the current directory. |
public static final int NUMBER_ELEMENTS_WRITTEN_ERRORED
public WriterRouterErrors(Writer delegate, ErrorReporter errorReporter)
public Optional<Outputter> createSubdirectory(String outputName, boolean inheritOutputRulesAndRecording)
outputName
- the name of the subdirectory.inheritOutputRulesAndRecording
- if true, the output rules and recording are inherited
from the parent directory. if false, they are not, and all outputs are allowed and are
unrecorded.Optional.empty()
.public <T> void write(String outputName, ElementWriterSupplier<T> elementWriter, ElementSupplier<T> element)
ElementWriter
to the current directory.outputName
- the name of the subdirectory. This may determine if an output is allowed or
not.elementWriter
- writes the element to the filesystemelement
- the element to writepublic <T> void writeWithIndex(IndexableOutputNameStyle outputNameStyle, ElementWriterSupplier<T> elementWriter, ElementSupplier<T> element, String index)
ElementWriter
in the current directory.outputNameStyle
- how to combine a particular output-name with an indexelementWriter
- writes the element to the filesystemelement
- the element to writeindex
- the indexpublic Optional<Path> createFilenameForWriting(String outputName, String extension)
This is an alternative method to write to the file system rather than using an ElementWriter
and write(String, ElementWriterSupplier, ElementSupplier)
and writeWithIndex(IndexableOutputNameStyle, ElementWriterSupplier, ElementSupplier, String)
.
outputName
- the output-name. This is the filename without an extension, and may
determine if an output is allowed or not.extension
- the extensionOptional.empty()
.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.