$darkmode
DENOPTIM
|
Static Public Member Functions | |
static void | addToRecentFiles (String fileName, FileFormat ff) |
Appends an entry to the list of recent files. More... | |
static void | addToRecentFiles (File file, FileFormat ff) |
Appends an entry to the list of recent files. More... | |
static boolean | isLineInTxtFile (String query, File file, boolean add) throws IOException |
Search in a file for a line matching the given string query. More... | |
static boolean | canWriteAndReadTo (String pathName) |
Check whether we can write and read to a given pathname. More... | |
static String | getTempFolder () |
Looks for a writable location where to put temporary files and returns an absolute pathname to the folder where tmp files can be created. More... | |
static boolean | createDirectory (String fileName) |
Creates a directory. More... | |
static boolean | checkExists (String fileName) |
static void | deleteFile (String fileName) throws DENOPTIMException |
Delete the file. More... | |
static void | deleteFilesContaining (String path, String pattern) throws DENOPTIMException |
Delete all files with pathname containing a given string. More... | |
static int | countLinesInFile (String fileName) throws DENOPTIMException |
Count the number of lines in the file. More... | |
static void | createZipFile (String zipOutputFileName, String[] filesToZip) throws Exception |
Creates a zip file. More... | |
static FileFormat | detectFileFormat (File inFile) throws UndetectedFileFormatException, IOException |
Inspects a file/folder and tries to detect if there is one of the data sources that is recognized by DENOPTIM. More... | |
static FileFormat | detectKindOfJSONFile (String fileName) throws IOException |
Detect the content of a json file. More... | |
static FileFormat | detectKindOfSDFFile (String fileName) throws IOException |
Looks into a text file and tries to understand if the file is a collection of parameters for any specific DENOPTIM module. More... | |
static FileFormat | detectKindOfParameterFile (String fileName) throws IOException |
Looks into a text file and tries to understand if the file is a collection of parameters for any specific DENOPTIM module. More... | |
static FileFormat | detectKindOfTXTFile (String fileName) throws IOException |
Looks into a text file and tries to understand if the file is a known text file. More... | |
static FileFormat | detectKindFile (String fileName, FileFormat[] ffs) throws IOException |
Looks into a text file and tries to understand what format it is among the given formats. More... | |
static File | getAvailableFileName (File parent, String baseName) throws DENOPTIMException |
Define a filename that can be used, i.e., is still available, because no other file with the same pathname exists. More... | |
static void | mergeIntoOneFile (String destinationPathname, List< String > sourcePathnames) throws IOException |
Copies the content of all the files specified in the list of sources and places it into the destination file. More... | |
Definition at line 57 of file FileUtils.java.
|
static |
Appends an entry to the list of recent files.
If the current list is reaching the max length, then this method will append the new entry and remove the oldest one.
file | the file to record. |
ff | the declared format of file. |
Definition at line 81 of file FileUtils.java.
References denoptim.logging.StaticLogger.appLogger, denoptim.constants.DENOPTIMConstants.EOL, denoptim.io.DenoptimIO.readRecentFilesMap(), denoptim.constants.DENOPTIMConstants.RECENTFILESLIST, and denoptim.io.DenoptimIO.writeData().
|
static |
Appends an entry to the list of recent files.
fileName | the file to record. |
ff | the declared format of file. |
Definition at line 67 of file FileUtils.java.
References denoptim.files.FileUtils.addToRecentFiles().
Referenced by denoptim.files.FileUtils.addToRecentFiles(), denoptim.programs.combinatorial.CEBLParameters.createWorkingDirectory(), denoptim.programs.fragmenter.FragmenterParameters.createWorkingDirectory(), denoptim.gui.CuttingRulesSelectionDialog.CuttingRulesSelectionDialog(), denoptim.gui.GUICompatibilityMatrixTab.initialize(), denoptim.gui.GUIGraphHandler.initialize(), denoptim.gui.GUIPrepare.initialize(), denoptim.gui.GUIVertexInspector.initialize(), denoptim.task.ProgramTask.printErrorToFile(), and denoptim.programs.fitnessevaluator.FRParameters.processParameters().
|
static |
Check whether we can write and read to a given pathname.
pathName |
true
if we can write and read in that pathname Definition at line 185 of file FileUtils.java.
References denoptim.io.DenoptimIO.readList(), and denoptim.io.DenoptimIO.writeData().
Referenced by denoptim.gui.Utils.getTempFile(), denoptim.files.FileUtils.getTempFolder(), and denoptim.gui.GUIPreferencesDialog.pathMustBeReadableWritable().
|
static |
fileName |
true
if file exists Definition at line 241 of file FileUtils.java.
Referenced by denoptim.fitness.FitnessParameters.checkParameters(), denoptim.fragspace.FragmentSpaceParameters.checkParameters(), denoptim.graph.rings.RingClosureParameters.checkParameters(), denoptim.programs.combinatorial.CEBLParameters.checkParameters(), denoptim.programs.fitnessevaluator.FRParameters.checkParameters(), denoptim.programs.genetweeker.GeneOpsRunnerParameters.checkParameters(), denoptim.programs.grapheditor.GraphEdParameters.checkParameters(), denoptim.programs.graphlisthandler.GraphListsHandlerParameters.checkParameters(), denoptim.programs.isomorphism.IsomorphismParameters.checkParameters(), denoptim.programs.RunTimeParameters.ensureFileExists(), denoptim.programs.RunTimeParameters.ensureFileExistsIfSet(), denoptim.gui.ParametersForm.importParametersFromDenoptimParamsFile(), denoptim.programs.grapheditor.GraphEdParameters.processParameters(), denoptim.programs.graphlisthandler.GraphListsHandlerParameters.processParameters(), denoptim.io.DenoptimIO.readRecentFilesMap(), denoptim.graph.rings.RingClosuresArchive.RingClosuresArchive(), and denoptim.programs.denovo.GAParametersTest.testLogging().
|
static |
Count the number of lines in the file.
fileName |
DENOPTIMException |
Definition at line 312 of file FileUtils.java.
|
static |
Creates a directory.
fileName |
true
if directory is successfully created Definition at line 231 of file FileUtils.java.
Referenced by denoptim.programs.combinatorial.CEBLParameters.createWorkingDirectory(), denoptim.programs.fragmenter.FragmenterParameters.createWorkingDirectory(), denoptim.constants.DENOPTIMConstants.ensureConfigFolderExists(), denoptim.files.FileUtils.getAvailableFileName(), denoptim.gui.GUIPrepare.prepareWorkSpace(), denoptim.io.DenoptimIOTest.testDetectFileFormat(), denoptim.programs.denovo.GAParametersTest.testLogging(), and denoptim.io.DenoptimIOTest.testReadGenerationFromSummary().
|
static |
Creates a zip file.
zipOutputFileName | |
filesToZip |
Exception |
Definition at line 349 of file FileUtils.java.
|
static |
Delete the file.
fileName |
DENOPTIMException |
Definition at line 256 of file FileUtils.java.
Referenced by denoptim.files.FileUtils.deleteFilesContaining(), denoptim.gui.GUIPreferencesDialog.pathMustBeReadableWritable(), denoptim.fragspace.FragmentSpaceTest.testFusedRingAddedToFragmentLibrary(), denoptim.fragspace.FragmentSpaceTest.testFusedRingAddedToScaffoldLibrary(), denoptim.fragspace.FragmentSpaceTest.testFusedRingOnlyAddedOnce(), and denoptim.fragspace.FragmentSpaceTest.testUseWholeMolGeometryForExtractedTemplates().
|
static |
Delete all files with pathname containing a given string.
path | |
pattern |
DENOPTIMException |
Definition at line 289 of file FileUtils.java.
References denoptim.files.FileUtils.deleteFile().
Referenced by denoptim.molecularmodeling.RingClosureTool.attemptRingClosure(), and denoptim.integration.tinker.ConformationalSearchPSSROT.performPSSROT().
|
static |
Inspects a file/folder and tries to detect if there is one of the data sources that is recognized by DENOPTIM.
inFile | the file to inspect |
UndetectedFileFormatException | when the format of the file could not be detected. |
IOException | when the the file could not be read properly. |
Definition at line 399 of file FileUtils.java.
References denoptim.files.FileUtils.detectKindOfJSONFile(), denoptim.files.FileUtils.detectKindOfParameterFile(), denoptim.files.FileUtils.detectKindOfSDFFile(), denoptim.files.FileUtils.detectKindOfTXTFile(), denoptim.files.FileFormat.FSE_RUN, denoptim.constants.DENOPTIMConstants.FSEIDXNAMEROOT, denoptim.files.FileFormat.GA_RUN, denoptim.constants.DENOPTIMConstants.GAGENDIRNAMEROOT, and denoptim.files.FileFormat.getExtension().
Referenced by denoptim.gui.GUIGraphHandler.appendGraphsFromFile(), denoptim.main.Main.ensureFileExistsAndIsReadable(), denoptim.gui.GUIGraphHandler.importGraphsFromFile(), denoptim.gui.MainToolBar.initialize(), denoptim.io.DenoptimIO.readDENOPTIMData(), denoptim.io.DenoptimIO.readDENOPTIMGraphsFromFile(), denoptim.io.DenoptimIO.readVertexes(), denoptim.gui.GUI.run(), and denoptim.io.DenoptimIOTest.testDetectFileFormat().
|
static |
Looks into a text file and tries to understand what format it is among the given formats.
fileName | The pathname of the file to analyze. |
ffs | the file formats to consider. |
Exception | when something goes wrong handling the file |
Definition at line 605 of file FileUtils.java.
Referenced by denoptim.files.FileUtils.detectKindOfParameterFile(), denoptim.files.FileUtils.detectKindOfSDFFile(), and denoptim.files.FileUtils.detectKindOfTXTFile().
|
static |
Detect the content of a json file.
fileName | file to analyze. |
IOException |
Definition at line 488 of file FileUtils.java.
References denoptim.json.DENOPTIMgson.getReader(), denoptim.files.FileFormat.GRAPHJSON, and denoptim.files.FileFormat.VRTXJSON.
Referenced by denoptim.files.FileUtils.detectFileFormat().
|
static |
Looks into a text file and tries to understand if the file is a collection of parameters for any specific DENOPTIM module.
fileName | The pathname of the file to analyze |
IOException | |
Exception |
Definition at line 570 of file FileUtils.java.
References denoptim.files.FileUtils.detectKindFile(), and denoptim.files.FileFormat.getParameterFormats().
Referenced by denoptim.files.FileUtils.detectFileFormat().
|
static |
Looks into a text file and tries to understand if the file is a collection of parameters for any specific DENOPTIM module.
fileName | The pathname of the file to analyze |
IOException | |
Exception |
Definition at line 554 of file FileUtils.java.
References denoptim.files.FileUtils.detectKindFile(), and denoptim.files.FileFormat.getSDFFormats().
Referenced by denoptim.files.FileUtils.detectFileFormat().
|
static |
Looks into a text file and tries to understand if the file is a known text file.
Note that parameters file, which are in fact text files, are not detected here ad they are treated by the dedicated method FileUtils#detectKindOfParameterFile(String)
.
fileName | The pathname of the file to analyze |
IOException | |
Exception |
Definition at line 588 of file FileUtils.java.
References denoptim.files.FileUtils.detectKindFile(), and denoptim.files.FileFormat.getTXTFormats().
Referenced by denoptim.files.FileUtils.detectFileFormat().
|
static |
Define a filename that can be used, i.e., is still available, because no other file with the same pathname exists.
This method returns a string like File_3
when files File
, File_1
, and File_2
exist already.
parent | the folder where the file is meant to be. |
baseName | the prefix of the filename. This string will be postponed by an integer number to identify an available filename. |
DENOPTIMException |
Definition at line 729 of file FileUtils.java.
References denoptim.files.FileUtils.createDirectory(), and denoptim.io.DenoptimIO.FS.
Referenced by denoptim.gui.CuttingRulesSelectionDialog.getTmpFileForCuttingRules(), and denoptim.gui.GUIPrepare.prepareWorkSpace().
|
static |
Looks for a writable location where to put temporary files and returns an absolute pathname to the folder where tmp files can be created.
Definition at line 204 of file FileUtils.java.
References denoptim.files.FileUtils.canWriteAndReadTo().
Referenced by denoptim.gui.Utils.getTempFile(), denoptim.io.DenoptimIO.readAllAtomContainers(), and denoptim.io.DenoptimIOTest.testReadAllAPClasses().
|
static |
Search in a file for a line matching the given string query.
If the query is not found in the file, then it is added to it. Note that the query is compared in a case insensitive manner, and ignoring heading/trailing spaces, and with the content of each line in the file, so this is rather slow.
query | the string to search for and possibly add to the file. |
file | the text file to analyze. |
add | if true then we add the query if it was not found. |
true
is the query was found in the file. Note that when add
is true
we return false
when the match is not found in the file, but the moment we return the file has been already updated by this method as to add the query. So, independently on the return value, the file will contain the query string when this method returns. IOException | when handling of the memory written on disk returns exception. |
Definition at line 132 of file FileUtils.java.
References denoptim.io.DenoptimIO.NL.
Referenced by denoptim.utils.SizeControlledSet.addNewUniqueEntry(), and denoptim.utils.SizeControlledSet.contains().
|
static |
Copies the content of all the files specified in the list of sources and places it into the destination file.
destinationPathname | the destination of all content. |
sourcePathnames | the pathnames of the files to be copied into the destination file. |
IOException |
Definition at line 768 of file FileUtils.java.
Referenced by denoptim.gui.GUIInspectGARun.initialize().