Interface OutputWriter
-
- All Known Implementing Classes:
FileOutputWriter,StdoutOutputWriter
public interface OutputWriterSuperclass for the different types of output writers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()Closes output target.default 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.
-
-
-
Method Detail
-
target
String target()
Returns aStringdescribing the target to which the output is written (primarily for logging purposes).- Returns:
- a
Stringdescribing the target to which the output is written to.
-
initialize
default void initialize() throws IOExceptionMakes 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.- Throws:
IOException
-
close
default void close() throws IOExceptionCloses 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()).- Throws:
IOException
-
write
void write(String output) throws IOException
Writes single piece of information to output target.- Parameters:
output- the output to be written to the output target- Throws:
IOException
-
writeHeader
void writeHeader(String output) throws IOException
Writes the header (if available) to the output target.- Parameters:
output-- Throws:
IOException
-
writeNewLine
void writeNewLine() throws IOExceptionGenerates a newline (if possible) in the output target.- Throws:
IOException
-
-