Package adams.core.io
Class MetaDataFileUtils
- java.lang.Object
-
- adams.core.io.MetaDataFileUtils
-
public class MetaDataFileUtils extends Object
Helper class for locating meta-data files.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MetaDataFileUtils.MetaDataLocation
Enum for locating the meta-data.
-
Constructor Summary
Constructors Constructor Description MetaDataFileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static File[]
find(LoggingObject source, PlaceholderFile dataFile, MetaDataFileUtils.MetaDataLocation location, String defaultExt, String[] exts)
Returns the list of meta-data files that were identified using the provided data file name.static File
find(LoggingObject source, File dataFile, String ext)
Looks for a meta-data file for the data file, using the specified extension.static File
find(LoggingObject source, File dataFile, String suffix, String ext)
Looks for a meta-data file for the data file, using the specified suffix and extension.static File[]
list(File dir, String prefix)
Lists all the files in the directory that match the specified prefix.
-
-
-
Method Detail
-
list
public static File[] list(File dir, String prefix)
Lists all the files in the directory that match the specified prefix.- Parameters:
dir
- the directory to scanprefix
- the prefix that the files require- Returns:
- the matching files
-
find
public static File[] find(LoggingObject source, PlaceholderFile dataFile, MetaDataFileUtils.MetaDataLocation location, String defaultExt, String[] exts)
Returns the list of meta-data files that were identified using the provided data file name.- Parameters:
source
- the caller, can be nulldataFile
- the data to list the meta-data files forlocation
- how to locate the meta-data filesdefaultExt
- the default extension to look for (no dot)exts
- all available extensions to look for (no dot)- Returns:
- the files
-
find
public static File find(LoggingObject source, File dataFile, String ext)
Looks for a meta-data file for the data file, using the specified extension. In case of "*" as extension, the first file that matches (and is not the data file) will get returned.- Parameters:
source
- the caller, can be nulldataFile
- the file to look for meta-data fileext
- the extension the meta-data file should have ('*' can be used)- Returns:
- the meta-data file, null if not found
-
find
public static File find(LoggingObject source, File dataFile, String suffix, String ext)
Looks for a meta-data file for the data file, using the specified suffix and extension. In case of "*" as extension, the first file that matches suffix (and is not the data file) will get returned.- Parameters:
source
- the caller, can be nulldataFile
- the file to look for meta-data filesuffix
- the (optional) suffix the meta-data file has (before .ext)ext
- the extension the meta-data file should have ('*' can be used)- Returns:
- the meta-data file, null if not found
-
-