public class OutputterChecked extends Object
Unlike Outputter
, exceptions are thrown when operations fail.
Further OutputterChecked
s can be derived in sub-directories or with different
prefixes.
A prefix can be associated with the outputter, which prepends a path (containing possibly both subdirectory and file-name parts) on all outputs.
Modifier and Type | Method and Description |
---|---|
void |
assignLogger(Logger logger)
Assigns a logger to the outputter, which is used to output warnings or messages when
outputting.
|
OutputterChecked |
changePrefix(DirectoryWithPrefix prefixToAssign)
Creates a
OutputterChecked with a changed prefix. |
static OutputterChecked |
createForDirectoryPermissive(Path pathDirectory,
DirectoryCreationParameters directoryCreation,
Optional<Logger> logger)
Creates, defaulting to a permissive output-manager in a particular directory.
|
static OutputterChecked |
createWithPrefix(DirectoryWithPrefix prefix,
MultiLevelOutputEnabled outputEnabled,
OutputWriteContext context,
Optional<MultiLevelRecordedOutputs> recordedOutputs,
DirectoryCreationParameters directoryCreation,
Optional<Logger> logger)
Creates a bound output-manager from an existing
OutputManager with a prefix. |
OutputterChecked |
deriveSubdirectory(String subdirectoryName,
boolean inheritOutputRulesAndRecording)
Derives a bound-output-manager for a (possibly newly created) subdirectory of the existing
manager
|
OutputWriteContext |
getContext()
General settings for writing outputs.
|
Path |
getOutputDirectory() |
MultiLevelOutputEnabled |
getOutputsEnabled()
Which outputs are enabled or not enabled.
|
DirectoryWithPrefix |
getPrefix() |
OutputWriteSettings |
getSettings()
General settings for outputting.
|
RecordingWriters |
getWriters()
The writers associated with this output-manager.
|
Path |
makeOutputPath(Optional<String> suffixWithoutExtension,
String extension,
String fallbackSuffix)
Like
makeOutputPath(String) but additionally adds an extension. |
Path |
makeOutputPath(String suffix)
Creates a full absolute path that completes the part of the path present in the outputter
with an additional suffix.
|
public static OutputterChecked createForDirectoryPermissive(Path pathDirectory, DirectoryCreationParameters directoryCreation, Optional<Logger> logger) throws BindFailedException
Outputs are not recorded.
pathDirectory
- directory to associate with output-managerdirectoryCreation
- how to create the output directory.logger
- logger for warning for information messages when outputtingBindFailedException
public static OutputterChecked createWithPrefix(DirectoryWithPrefix prefix, MultiLevelOutputEnabled outputEnabled, OutputWriteContext context, Optional<MultiLevelRecordedOutputs> recordedOutputs, DirectoryCreationParameters directoryCreation, Optional<Logger> logger) throws BindFailedException
OutputManager
with a prefix.outputEnabled
- which outputs are enabled or notprefix
- the prefixcontext
- associated output contextdirectoryCreation
- how to create the output directory.recordedOutputs
- if defined, records output-names that are written / not-written in
OutputterChecked
(but not any sub-directories thereof)logger
- logger for warning for information messages when outputtingBindFailedException
- if a directory cannot be created at the intended path.public OutputterChecked changePrefix(DirectoryWithPrefix prefixToAssign) throws BindFailedException
OutputterChecked
with a changed prefix.
All other attributes are identical to the OutputterChecked
on which this method is
called.
prefixToAssign
- prefix to assign.OutputterChecked
apart from the two aforementioned
changes.BindFailedException
public OutputterChecked deriveSubdirectory(String subdirectoryName, boolean inheritOutputRulesAndRecording)
subdirectoryName
- the subdirectory-name.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.public OutputWriteSettings getSettings()
public Path getOutputDirectory()
public Path makeOutputPath(String suffix)
suffix
- the suffix for the pathpublic Path makeOutputPath(Optional<String> suffixWithoutExtension, String extension, String fallbackSuffix)
makeOutputPath(String)
but additionally adds an extension.suffixWithoutExtension
- the suffix for the path (without any extension).fallbackSuffix
- if neither a prefix
is defined nor a suffix
, then this
provides a suffix to use so a file isn't only an extension.public void assignLogger(Logger logger)
logger
- the logger to assignpublic DirectoryWithPrefix getPrefix()
public RecordingWriters getWriters()
public MultiLevelOutputEnabled getOutputsEnabled()
public OutputWriteContext getContext()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.