Interface DataFolder

All Known Implementing Classes:
FsDataFolder, VfsDataFolder

public interface DataFolder
Represents a folder from the file system or the classpath that contains data to import with a DataProvider.
Author:
Tobias Liefke
  • Method Details

    • findFile

      default DataFile findFile(String name)
      Finds a file in this folder.
      Parameters:
      name - the name of the file
      Returns:
      the file or null if no file with such a name exists
    • findFolder

      default DataFolder findFolder(String name)
      Finds a sub folder in this folder.
      Parameters:
      name - the name of the sub folder
      Returns:
      the sub folder or null if no folder with such a name exists
    • forAllFiles

      default void forAllFiles(BiConsumer<DataFolder,DataFile> consumer) throws IOException
      Finds all files in this folder and in all sub folders and handles them with the given consumer.
      Parameters:
      consumer - handles each of the files
      Throws:
      IOException - if one of the files was not accessible
    • forAllFiles

      default void forAllFiles(Consumer<DataFile> consumer) throws IOException
      Finds all files in this folder and in all sub folders and handles them with the given consumer.
      Parameters:
      consumer - handles each of the files
      Throws:
      IOException - if one of the files was not accessible
    • getFiles

      List<? extends DataFile> getFiles()
      Finds all files inside this folder. Will not return a file from a sub folder
      Returns:
      the files in this folder
    • getFolder

      default DataFolder getFolder(String name)
      Finds a sub folder in this folder.
      Parameters:
      name - the name of the sub folder
      Returns:
      the sub folder or an empty folder, if no such folder exists
    • getFolders

      List<? extends DataFolder> getFolders()
      Finds the all sub folders inside this folder.
      Returns:
      the direct children of this folder
    • getName

      String getName()
      The name of this folder.
      Returns:
      the name of this folder, empty or null for the root folder
    • getParent

      DataFolder getParent()
      The parent folder of this folder.
      Returns:
      the parent or null if this folder is the root folder
    • getPath

      default DataFolder getPath(String path)
      Splits the given path by '/' and returns the folder according to the single path elements.
      Parameters:
      path - the relative path to the folder from this folder
      Returns:
      the folder for the given path