java.lang.Object
de.unijena.cheminf.clustering.art2a.util.FileUtil

public final class FileUtil extends Object
File utility. The class provides convenience methods.
  • Constructor Details

    • FileUtil

      public FileUtil()
  • Method Details

    • setUpClusteringResultTextFilePrinters

      public static <T extends Writer> T[] setUpClusteringResultTextFilePrinters(String aPathName, Class<T> aWriterClass)
      Set up the clustering result text file writers. This method creates a set of Writer objects based on the specified and desired Writer typ for writing the clustering result and clustering process to separate text files. This methode allows the user to create 3 different Writer types, e.g. FileWriter, PrintWriter and BufferedWriter. The user can specify the Writer typ via the aWriterClass parameter. The file names will include a timestamp to make them unique. The method creates the necessary files in the specified path. If necessary, existing result files will also be deleted.
      Type Parameters:
      T - generic typ of the Writer. This will be determined, based on the specified aWriterClass parameter.
      Parameters:
      aPathName - path to the export folder where the text files are to be saved.
      aWriterClass - Writer ytp to be created. The user can choose one of the supported classes.
      Returns:
      Writer[] an array of a Writer objects, where index 0 corresponds to the clustering result Writer, and index 1 corresponds to the clustering process Writer.
    • importFloatDataMatrixFromTextFile

      public static float[][] importFloatDataMatrixFromTextFile(String aFilePath, char aSeparator) throws IllegalArgumentException
      The text file contains input vectors/fingerprints that are read in to prepare them for float clustering. Each line of the text file represents one input vector/fingerprint. Each component of the vector is separated by a separator. The file has no header line.
      Parameters:
      aFilePath - path of the text file
      aSeparator - separator of the text file to separate the input vector/fingerprint components from each other.
      Returns:
      float matrix is returned that contains the input vectors/fingerprints that were read in. Each row of the matrix represents one fingerprint.
      Throws:
      IllegalArgumentException - is thrown if the given file path is invalid.
    • importDoubleDataMatrixFromTextFile

      public static double[][] importDoubleDataMatrixFromTextFile(String aFilePath, char aSeparator) throws IllegalArgumentException
      The text file contains input vectors/fingerprints that are read in to prepare them for double clustering. Each line of the text file represents one input vector/fingerprint. Each component of the vector is separated by a separator. The file has no header line.
      Parameters:
      aFilePath - path of the text file
      aSeparator - separator of the text file to separate the input vector/fingerprint components from each other.
      Returns:
      double matrix is returned that contains the input vectors/fingerprints that were read in. Each row of the matrix represents one fingerprint.
      Throws:
      IllegalArgumentException - is thrown if the given file path is invalid.