Class StringGenerator
- All Implemented Interfaces:
Generator<String>,TransformingGenerator<String,,String> ElementWriter<String>
A generator that writes the contents of a
String to the file-system as text-file.- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionselectFileExtension(OutputWriteSettings settings, Optional<Logger> logger) Selects the file/extension to be used for outputting the file.voidwriteToFile(String element, OutputWriteSettings settings, Path filePath) Write generated content for {code element} to the filefilePath.Methods inherited from class org.anchoranalysis.io.generator.OneStageGenerator
transformMethods inherited from class org.anchoranalysis.io.generator.SingleFileTypeGenerator
write, writeWithIndex
-
Constructor Details
-
StringGenerator
public StringGenerator()
-
-
Method Details
-
writeToFile
public void writeToFile(String element, OutputWriteSettings settings, Path filePath) throws OutputWriteFailedException Description copied from class:SingleFileTypeGeneratorWrite generated content for {code element} to the filefilePath.This function deliberately leaves ambiguity over what occurs if a file already exists at
filePath.- Specified by:
writeToFilein classSingleFileTypeGenerator<String,String> - Parameters:
element- element to be assigned and then transformed.settings- settings for outputting.filePath- the path to the file to write to.- Throws:
OutputWriteFailedException- if the content cannot be written successfully.
-
selectFileExtension
Description copied from class:SingleFileTypeGeneratorSelects the file/extension to be used for outputting the file.- Specified by:
selectFileExtensionin classSingleFileTypeGenerator<String,String> - Parameters:
settings- settings for outputting.logger- logger for warning for information messages when outputting.- Returns:
- the file extension (without leading period) to be used for outputting.
-