Package jsl.utilities.reporting
Class OutputDirectory
- java.lang.Object
-
- jsl.utilities.reporting.OutputDirectory
-
public class OutputDirectory extends java.lang.Object
This class provides basic context for creating and writing output files. Files and directories created by instances of this class will be relative to the Path supplied at creation.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Logger
LOGGER
for loggingLogPrintWriter
out
Can be used like System.out, but instead writes to a file found in the base output directory
-
Constructor Summary
Constructors Constructor Description OutputDirectory()
Creates a OutputDirectory with the current program launch directory with the base directory, "OutputDir" and "Output_Out.txt" as the file name related to property outOutputDirectory(java.lang.String outDirName, java.lang.String outFileName)
Creates a OutputDirectory with the current program launch directory as the base directoryOutputDirectory(java.nio.file.Path outputDirectory, java.lang.String outFileName)
Creates an OutputDirectory based on the supplied path
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.file.Path
getExcelDir()
java.nio.file.Path
getOutDir()
java.io.File
makeFile(java.lang.String fileName)
Makes a new PrintWriter within the base directory with the given file namejava.io.PrintWriter
makePrintWriter(java.lang.String fileName)
Makes a new PrintWriter within the base directory with the given file namejava.nio.file.Path
makeSubDirectory(java.lang.String dirName)
Makes a Path to the named sub-directory within the base directory
-
-
-
Field Detail
-
LOGGER
public static final org.slf4j.Logger LOGGER
for logging
-
out
public final LogPrintWriter out
Can be used like System.out, but instead writes to a file found in the base output directory
-
-
Constructor Detail
-
OutputDirectory
public OutputDirectory()
Creates a OutputDirectory with the current program launch directory with the base directory, "OutputDir" and "Output_Out.txt" as the file name related to property out
-
OutputDirectory
public OutputDirectory(java.lang.String outDirName, java.lang.String outFileName)
Creates a OutputDirectory with the current program launch directory as the base directory- Parameters:
outDirName
- the name of the directory within the current launch directoryoutFileName
- the name of the created text file related to property out
-
OutputDirectory
public OutputDirectory(java.nio.file.Path outputDirectory, java.lang.String outFileName)
Creates an OutputDirectory based on the supplied path- Parameters:
outputDirectory
- the base output directory to use for writing text files relative to this OutputDirectory instanceoutFileName
- the name of the created text file related to property out
-
-
Method Detail
-
getOutDir
public final java.nio.file.Path getOutDir()
- Returns:
- the path to the base directory for this OutputDirectory
-
getExcelDir
public final java.nio.file.Path getExcelDir()
- Returns:
- the path to the default excel directory, relative to this output directory
-
makePrintWriter
public final java.io.PrintWriter makePrintWriter(java.lang.String fileName)
Makes a new PrintWriter within the base directory with the given file name- Parameters:
fileName
- the name of the file for the PrintWriter- Returns:
- the PrintWriter, or System.out if there was some problem with its creation
-
makeFile
public final java.io.File makeFile(java.lang.String fileName)
Makes a new PrintWriter within the base directory with the given file name- Parameters:
fileName
- the name of the file for the PrintWriter- Returns:
- the File in the base directory
-
makeSubDirectory
public final java.nio.file.Path makeSubDirectory(java.lang.String dirName)
Makes a Path to the named sub-directory within the base directory- Parameters:
dirName
- the name of the sub-directory to create. It must not be null- Returns:
- a path to the created sub-directory, or the base directory if something went wrong in the creation. Any problems are logged.
-
-