Class FileOutputWriter
- java.lang.Object
-
- org.molgenis.vibe.cli.io.output.target.FileOutputWriter
-
- All Implemented Interfaces:
OutputWriter
public class FileOutputWriter extends Object implements OutputWriter
Writer for writing output to a file.
-
-
Constructor Summary
Constructors Constructor Description FileOutputWriter(Path path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes output target.PathgetPath()voidinitialize()Makes preparations for writing output to an output target.Stringtarget()Returns aStringdescribing the target to which the output is written (primarily for logging purposes).voidwrite(String output)Writes single piece of information to output target.voidwriteHeader(String output)Writes the header (if available) to the output target.voidwriteNewLine()Generates a newline (if possible) in the output target.
-
-
-
Constructor Detail
-
FileOutputWriter
public FileOutputWriter(Path path)
-
-
Method Detail
-
getPath
public Path getPath()
-
target
public String target()
Description copied from interface:OutputWriterReturns aStringdescribing the target to which the output is written (primarily for logging purposes).- Specified by:
targetin interfaceOutputWriter- Returns:
- a
Stringdescribing the target to which the output is written to.
-
initialize
public void initialize() throws IOExceptionDescription copied from interface:OutputWriterMakes preparations for writing output to an output target. The default is empty and should be overridden by the implementation if aninitialize()step is needed before actual data is written.- Specified by:
initializein interfaceOutputWriter- Throws:
IOException
-
close
public void close() throws IOExceptionDescription copied from interface:OutputWriterCloses output target. The default is empty and should be overridden by the implementation if aclose()step is needed after the data is written (to cleanly close off the target opened duringinitialize()).- Specified by:
closein interfaceOutputWriter- Throws:
IOException
-
write
public void write(String output) throws IOException
Description copied from interface:OutputWriterWrites single piece of information to output target.- Specified by:
writein interfaceOutputWriter- Parameters:
output- the output to be written to the output target- Throws:
IOException
-
writeHeader
public void writeHeader(String output) throws IOException
Description copied from interface:OutputWriterWrites the header (if available) to the output target.- Specified by:
writeHeaderin interfaceOutputWriter- Throws:
IOException
-
writeNewLine
public void writeNewLine() throws IOExceptionDescription copied from interface:OutputWriterGenerates a newline (if possible) in the output target.- Specified by:
writeNewLinein interfaceOutputWriter- Throws:
IOException
-
-