Class OutputterChecked
Object
OutputterChecked
A particular directory on the filesystem in which outputting can occur.
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.
- Author:
- Owen Feehan
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assignLogger
(Logger logger) Assigns a logger to the outputter, which is used to output warnings or messages when outputting.changePrefix
(DirectoryWithPrefix prefixToAssign) Creates aOutputterChecked
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 existingOutputManager
with a prefix.deriveSubdirectory
(String subdirectoryName, boolean inheritOutputRulesAndRecording) Derives a bound-output-manager for a (possibly newly created) subdirectory of the existing managerGeneral settings for writing outputs.The directory into which outputting occurs.Which outputs are enabled or not enabled.The directory and prefix into which outputting occurs.General settings for outputting.The writers associated with this output-manager.makeOutputPath
(String suffix) Creates a full absolute path that completes the part of the path present in the outputter with an additional suffix.makeOutputPath
(Optional<String> suffixWithoutExtension, String extension, String fallbackSuffix) LikemakeOutputPath(String)
but additionally adds an extension.
-
Method Details
-
createForDirectoryPermissive
public static OutputterChecked createForDirectoryPermissive(Path pathDirectory, DirectoryCreationParameters directoryCreation, Optional<Logger> logger) throws BindFailedException Creates, defaulting to a permissive output-manager in a particular directory.Outputs are not recorded.
- Parameters:
pathDirectory
- directory to associate with output-managerdirectoryCreation
- how to create the output directory.logger
- logger for warning for information messages when outputting- Returns:
- the created outputter.
- Throws:
BindFailedException
- if a directory cannot be created at the intended path.
-
createWithPrefix
public static OutputterChecked createWithPrefix(DirectoryWithPrefix prefix, MultiLevelOutputEnabled outputEnabled, OutputWriteContext context, Optional<MultiLevelRecordedOutputs> recordedOutputs, DirectoryCreationParameters directoryCreation, Optional<Logger> logger) throws BindFailedException Creates a bound output-manager from an existingOutputManager
with a prefix.- Parameters:
prefix
- the prefixoutputEnabled
- which outputs are enabled or notcontext
- associated output contextrecordedOutputs
- if defined, records output-names that are written / not-written inOutputterChecked
(but not any sub-directories thereof)directoryCreation
- how to create the output directory.logger
- logger for warning for information messages when outputting- Returns:
- the created outputter.
- Throws:
BindFailedException
- if a directory cannot be created at the intended path.
-
changePrefix
Creates aOutputterChecked
with a changed prefix.All other attributes are identical to the
OutputterChecked
on which this method is called.- Parameters:
prefixToAssign
- prefix to assign.- Returns:
- a newly created identical
OutputterChecked
apart from the two aforementioned changes. - Throws:
BindFailedException
- if a directory cannot be created at the intended path.
-
deriveSubdirectory
public OutputterChecked deriveSubdirectory(String subdirectoryName, boolean inheritOutputRulesAndRecording) Derives a bound-output-manager for a (possibly newly created) subdirectory of the existing manager- Parameters:
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.- Returns:
- a bound-output-manager for the subdirectory.
-
getSettings
General settings for outputting.- Returns:
- the settings.
-
getOutputDirectory
The directory into which outputting occurs.- Returns:
- a path to the directory.
-
makeOutputPath
Creates a full absolute path that completes the part of the path present in the outputter with an additional suffix.- Parameters:
suffix
- the suffix for the path- Returns:
- a newly created absolute path, combining directory, prefix (if it exists) and suffix.
-
makeOutputPath
public Path makeOutputPath(Optional<String> suffixWithoutExtension, String extension, String fallbackSuffix) LikemakeOutputPath(String)
but additionally adds an extension.- Parameters:
suffixWithoutExtension
- the suffix for the path (without any extension).extension
- a file extension (without a leading period).fallbackSuffix
- if neither aprefix
is defined nor asuffix
, then this provides a suffix to use so a file isn't only an extension.- Returns:
- a newly created absolute path, combining directory, prefix (if it exists), suffix and extension.
-
assignLogger
Assigns a logger to the outputter, which is used to output warnings or messages when outputting.- Parameters:
logger
- the logger to assign
-
getPrefix
The directory and prefix into which outputting occurs.- Returns:
- the directory and prefix.
-
getWriters
The writers associated with this output-manager. -
getOutputsEnabled
Which outputs are enabled or not enabled. -
getContext
General settings for writing outputs.
-