public class UtilitiesPathPreferences extends Object
Modifier and Type | Class and Description |
---|---|
static class |
UtilitiesPathPreferences.UtilitiesPathKey
Enum of the paths which can be set in utilities.
|
Modifier and Type | Field and Description |
---|---|
static String |
configurationFileName
Default name for the path configuration file.
|
static String |
defaultPath
Replacement for the path when not available.
|
static String |
separator
The separator between a path ID and a path.
|
Constructor and Description |
---|
UtilitiesPathPreferences() |
Modifier and Type | Method and Description |
---|---|
static ArrayList<PathKey> |
getErrorKeys()
Returns a list containing the keys of the paths where the tool is not
able to write.
|
static String |
getPath(String line)
Returns the path at the given line.
|
static String |
getPathID(String line)
Returns the path id line.
|
static String |
getPathPreference(UtilitiesPathPreferences.UtilitiesPathKey utilitiesPathKey)
Returns the path according to the given key and path.
|
static void |
loadPathPreferenceFromLine(String line)
Loads a path to be set from a line.
|
static void |
loadPathPreferencesFromFile(File inputFile)
Loads the path preferences from a text file.
|
static void |
setAllPathsIn(String path)
Sets all the paths inside a given folder.
|
static void |
setPathPreference(UtilitiesPathPreferences.UtilitiesPathKey utilitiesPathKey,
String path)
Sets the path according to the given key and path.
|
static boolean |
testPath(String destinationPath)
Tests whether it is possible to write in a destination folder.
|
static void |
writeConfigurationToFile(BufferedWriter bw)
Writes the configuration file using the provided buffered writer.
|
static void |
writeConfigurationToFile(File file)
Writes all path configurations to the given file.
|
static void |
writePathToFile(BufferedWriter bw,
UtilitiesPathPreferences.UtilitiesPathKey pathKey)
Writes the path of interest using the provided buffered writer.
|
public static final String configurationFileName
public static final String separator
public static final String defaultPath
public static void loadPathPreferencesFromFile(File inputFile) throws FileNotFoundException, IOException
inputFile
- the file to load the path preferences fromFileNotFoundException
- if a FileNotFoundException occursIOException
- if an IOException occurspublic static void loadPathPreferenceFromLine(String line) throws FileNotFoundException
line
- the line where to read the path fromFileNotFoundException
- if a FileNotFoundException occurspublic static void setPathPreference(UtilitiesPathPreferences.UtilitiesPathKey utilitiesPathKey, String path)
utilitiesPathKey
- the key of the pathpath
- the path to be setpublic static String getPathPreference(UtilitiesPathPreferences.UtilitiesPathKey utilitiesPathKey)
utilitiesPathKey
- the key of the pathpublic static String getPathID(String line)
line
- the line of interestpublic static String getPath(String line)
line
- the linepublic static void setAllPathsIn(String path) throws FileNotFoundException
path
- the path of the folder where to redirect all paths.FileNotFoundException
- if a FileNotFoundException occurspublic static void writeConfigurationToFile(File file) throws IOException
file
- the destination fileIOException
- if an IOException occurspublic static void writeConfigurationToFile(BufferedWriter bw) throws IOException
bw
- the writer to use for writingIOException
- if an IOException occurspublic static void writePathToFile(BufferedWriter bw, UtilitiesPathPreferences.UtilitiesPathKey pathKey) throws IOException
bw
- the writer to use for writingpathKey
- the key of the path of interestIOException
- if an IOException occurspublic static boolean testPath(String destinationPath)
destinationPath
- the folder to testpublic static ArrayList<PathKey> getErrorKeys() throws IOException
IOException
- exception thrown whenever an error occurred while
loading the path configurationCopyright © 2016. All rights reserved.