public class IOUtilities extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
LICENSE_RESULTS_FILE
The constant for the license validation result file.
|
static String |
LICENSE_SETTINGS_FILE
This is the constant for the settings properties file.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
createDirectoryIfNotPresent(org.apache.maven.plugin.logging.Log log,
File directory)
This method checks a directory for presence.
|
static void |
createFileIfNotPresent(org.apache.maven.plugin.logging.Log log,
File file)
This method checks a file for presence.
|
static File |
createNewResultsFile(org.apache.maven.plugin.logging.Log log,
File outputDirectory)
Creates a new and empty results file.
|
static File |
createNewSettingsFile(org.apache.maven.plugin.logging.Log log,
File outputDirectory)
Creates a new and empty settings file.
|
static void |
deleteFileIfPresent(org.apache.maven.plugin.logging.Log log,
File file)
This method checks the presence of a file.
|
static File |
getResultsFile(org.apache.maven.plugin.logging.Log log,
File outputDirectory)
Returns the position of the results file.
|
static File |
getSettingsFile(org.apache.maven.plugin.logging.Log log,
File outputDirectory)
This method checks and returns the position of the settings file.
|
static ValidationResult |
readResult(BufferedReader bufferedReader)
Reads a single CSV line from a
BufferedReader and converts it
into a ValidationResult. |
static <T> T |
restoreObject(File file)
This method returns a former serialized object from a file.
|
protected static String[] |
split(String line)
This method splits a single CSV line into junks of
String. |
static void |
storeObject(File file,
Serializable object)
Stores any
Serializable object into a file. |
static void |
writeResult(Writer writer,
ValidationResult validationResult)
Writes a CSV file line with the given
ValidationResult. |
public static final String LICENSE_RESULTS_FILE
public static final String LICENSE_SETTINGS_FILE
public static File createNewResultsFile(org.apache.maven.plugin.logging.Log log, File outputDirectory) throws org.apache.maven.plugin.MojoExecutionException
log - is the Log to write to.outputDirectory - is the directory for the output file.File object is returned pointing to the newly created
results file.org.apache.maven.plugin.MojoExecutionException - is thrown in case the file could not be created.public static File getResultsFile(org.apache.maven.plugin.logging.Log log, File outputDirectory) throws org.apache.maven.plugin.MojoExecutionException
log - is the Log to write to.outputDirectory - is the directory for the output file.File object is returned pointing to the results file.org.apache.maven.plugin.MojoExecutionException - is thrown if no file is found.public static File createNewSettingsFile(org.apache.maven.plugin.logging.Log log, File outputDirectory) throws org.apache.maven.plugin.MojoExecutionException
log - is the Log to write to.outputDirectory - is the directory for the output file.File object is returned pointing to the newly created
settings file.org.apache.maven.plugin.MojoExecutionException - is thrown in case the file could not be created.public static File getSettingsFile(org.apache.maven.plugin.logging.Log log, File outputDirectory) throws org.apache.maven.plugin.MojoExecutionException
log - is the Log to write to.outputDirectory - is the directory for the output file.File object is returned pointing to the settings file.org.apache.maven.plugin.MojoExecutionException - is thrown in case the file could not be found.public static void createDirectoryIfNotPresent(org.apache.maven.plugin.logging.Log log,
File directory)
throws org.apache.maven.plugin.MojoExecutionException
log - is the Log to write to.directory - is the directory to be checked and created if needed.org.apache.maven.plugin.MojoExecutionException - is thrown if the directory is not present and could not be
created.public static void createFileIfNotPresent(org.apache.maven.plugin.logging.Log log,
File file)
throws org.apache.maven.plugin.MojoExecutionException
log - is the Log to write to.file - is the directory to be checked and created if needed.org.apache.maven.plugin.MojoExecutionException - is thrown if the directory is not present and could not be
created.public static void deleteFileIfPresent(org.apache.maven.plugin.logging.Log log,
File file)
throws org.apache.maven.plugin.MojoExecutionException
log - is the Maven logger Log.file - is the files to be deleted if present.org.apache.maven.plugin.MojoExecutionException - is thrown in cases of IO issues.public static void writeResult(Writer writer, ValidationResult validationResult) throws org.apache.maven.plugin.MojoExecutionException
ValidationResult.writer - is the Writer to write to.validationResult - is the ValidationResult object which is to be written
to the writer.org.apache.maven.plugin.MojoExecutionException - is thrown in cases of IO issues.public static ValidationResult readResult(BufferedReader bufferedReader) throws org.apache.maven.plugin.MojoExecutionException
BufferedReader and converts it
into a ValidationResult.bufferedReader - is the BufferedReader to read from.ValidationResult is returned containing the read
information.org.apache.maven.plugin.MojoExecutionException - is thrown in case of IO issues.protected static String[] split(String line)
String.line - is the line to be split.String is returned.public static void storeObject(File file, Serializable object) throws IOException
Serializable object into a file.file - is the file where the object is to be stored to.object - is the objec which is to be stored.IOException - is thrown in cases of IO issues.public static <T> T restoreObject(File file) throws IOException
T - is the actual type of the object read from the file.file - is the file to read the object from.IOException - is thrown in cases of IO issues.Copyright © 2013–2015 PureSol Technologies. All rights reserved.