Class ReporterPathPreferences

java.lang.Object
eu.isas.reporter.preferences.ReporterPathPreferences

public class ReporterPathPreferences extends Object
This class sets the path preferences for the files to read/write.
Author:
Marc Vaudel, Harald Barsnes
  • Constructor Details

    • ReporterPathPreferences

      public ReporterPathPreferences()
  • Method Details

    • loadPathParametersFromFile

      public static void loadPathParametersFromFile(File inputFile) throws FileNotFoundException, IOException
      Loads the path preferences from a text file.
      Parameters:
      inputFile - the file to load the path preferences from
      Throws:
      FileNotFoundException - thrown if an FileNotFoundException occurs
      IOException - thrown if an IOException occurs
    • loadPathParametersFromLine

      public static void loadPathParametersFromLine(String line) throws FileNotFoundException, IOException
      Loads a path to be set from a line.
      Parameters:
      line - the line where to read the path from
      Throws:
      FileNotFoundException - thrown of the file cannot be found
      IOException
    • setPathPreference

      public static void setPathPreference(ReporterPathPreferences.ReporterPathKey reporterPathKey, String path)
      Sets the path according to the given key and path.
      Parameters:
      reporterPathKey - the key of the path
      path - the path to be set
    • setAllPathsIn

      public static void setAllPathsIn(String path) throws FileNotFoundException
      Sets all the paths inside a given folder.
      Parameters:
      path - the path of the folder where to redirect all paths.
      Throws:
      FileNotFoundException - thrown if a file cannot be found
    • writeConfigurationToFile

      public static void writeConfigurationToFile(File file) throws IOException
      Writes all path configurations to the given file.
      Parameters:
      file - the destination file
      Throws:
      FileNotFoundException - thrown if an FileNotFoundException occurs
      IOException
    • writeConfigurationToFile

      public static void writeConfigurationToFile(com.compomics.util.io.flat.SimpleFileWriter writer) throws IOException
      Writes the configuration file using the provided buffered writer.
      Parameters:
      writer - the writer to use for writing.
      Throws:
      FileNotFoundException - thrown if an FileNotFoundException occurs
      IOException
    • writePathToFile

      public static void writePathToFile(com.compomics.util.io.flat.SimpleFileWriter writer, ReporterPathPreferences.ReporterPathKey pathKey) throws IOException
      Writes the path of interest using the provided buffered writer.
      Parameters:
      writer - the writer to use for writing
      pathKey - the key of the path of interest
      Throws:
      IOException - thrown if an IOException occurs
    • getPathPreference

      public static String getPathPreference(ReporterPathPreferences.ReporterPathKey reporterPathKey, String jarFilePath)
      Returns the path according to the given key and path.
      Parameters:
      reporterPathKey - the key of the path
      jarFilePath - path to the jar file
      Returns:
      the path
    • getErrorKeys

      public static ArrayList<com.compomics.software.settings.PathKey> getErrorKeys(String jarFilePath) throws IOException
      Returns a list containing the keys of the paths where the tool is not able to write.
      Parameters:
      jarFilePath - the path to the jar file
      Returns:
      a list containing the keys of the paths where the tool is not able to write
      Throws:
      IOException - exception thrown whenever an error occurred while loading the path configuration