KSLFile Util
Provides some basic file utilities. Additional utilities can be found in Google Guava and Apache Commons IO. However, this basic IO provides basic needs without external libraries and is integrated withe KSL functionality.
Properties
Returns the path to the directory that the program was launched from on the OS. This call may throw a SecurityException if the system information is not accessible. Uses System property "user.dir"
Returns the directory that the program was launched from on the OS as a string. This call may throw a SecurityException if the system information is not accessible. Uses System property "user.dir"
System.out as a PrintWriter
Functions
Makes a String that has the form name.csv
Will throw an IOException if something goes wrong in the creation.
Makes a String that has the form name.ext If an extension already exists it is replaced.
Makes a LogPrintWriter from the given File. IOExceptions are caught and logged. If the file exists it will be written over.
Makes a PrintWriter from the given path, any IOExceptions are caught and logged.
Makes a PrintWriter from the given File. IOExceptions are caught and logged. If the file exists it is written over.
Makes a PrintWriter from the given path, any IOExceptions are caught and logged. The path must be to a file, not a directory. If the directories that are on the path do not exist, they are created. If the referenced file exists it is written over.
Makes the file in the directory that the program launched within
Creates a subdirectory within the supplied main directory.
Makes a String that has the form name.txt
Recursively deletes
This method will check for the dot ‘.' occurrence in the given filename. If it exists, then it will find the last position of the dot ‘.' and return the characters after that, the characters after the last dot ‘.' known as the file extension. Special Cases:
This method will check for the dot ‘.' occurrence in the given filename. If it exists, then it will find the last position of the dot ‘.' and return the characters after that, the characters after the last dot ‘.' known as the file extension. Special Cases:
Assumes that the file holds doubles with each value on a different line 1.0 4.0 2.0 etc
Allows writing directly to a known PrintWriter. Facilitates writing to the file before or after the array is written
Allows writing directly to a known PrintWriter. Facilitates writing to the file before or after the list is written
Writes the data in the array to rows in the file, each element in a row is separated by a comma
Writes the data in the array to rows in the file, each row with one data point