Package adams.core.io

Class MetaDataFileUtils


  • public class MetaDataFileUtils
    extends Object
    Helper class for locating meta-data files.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • MetaDataFileUtils

        public MetaDataFileUtils()
    • 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 scan
        prefix - 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 null
        dataFile - the data to list the meta-data files for
        location - how to locate the meta-data files
        defaultExt - 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 null
        dataFile - the file to look for meta-data file
        ext - 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 null
        dataFile - the file to look for meta-data file
        suffix - 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