Class VfsDataFolder

java.lang.Object
org.fastnate.data.files.VfsDataFolder
All Implemented Interfaces:
DataFolder

public class VfsDataFolder extends Object implements DataFolder
Represents a folder from the class path. Wraps a set of Vfs.Dirs.
Author:
Tobias Liefke
  • Constructor Details

    • VfsDataFolder

      public VfsDataFolder(List<org.reflections.vfs.Vfs.Dir> dirs)
      Creates a new root folder.
      Parameters:
      dirs - the directories that represent the root of the data folder
    • VfsDataFolder

      public VfsDataFolder(List<org.reflections.vfs.Vfs.Dir> dirs, VfsDataFolder parent, String relativePath, String name)
      Creates a new VfsDataFolder instance.
      Parameters:
      dirs - All root directories.
      parent - The parent directory, null if this represents the root folder.
      relativePath - The full path to this folder from dirs, null if this represents the root folder.
      name - The name of this folder, null if this represents the root folder.
  • Method Details

    • findFile

      public DataFile findFile(String fileName)
      Description copied from interface: DataFolder
      Finds a file in this folder.
      Specified by:
      findFile in interface DataFolder
      Parameters:
      fileName - the name of the file
      Returns:
      the file or null if no file with such a name exists
    • findFolder

      public DataFolder findFolder(String folderName)
      Description copied from interface: DataFolder
      Finds a sub folder in this folder.
      Specified by:
      findFolder in interface DataFolder
      Parameters:
      folderName - the name of the sub folder
      Returns:
      the sub folder or null if no folder with such a name exists
    • getFiles

      public List<VfsDataFile> getFiles()
      Description copied from interface: DataFolder
      Finds all files inside this folder. Will not return a file from a sub folder
      Specified by:
      getFiles in interface DataFolder
      Returns:
      the files in this folder
    • getFolders

      public List<VfsDataFolder> getFolders()
      Description copied from interface: DataFolder
      Finds the all sub folders inside this folder.
      Specified by:
      getFolders in interface DataFolder
      Returns:
      the direct children of this folder
    • getParent

      public VfsDataFolder getParent()
      The parent directory, null if this represents the root folder.
      Specified by:
      getParent in interface DataFolder
      Returns:
      the parent or null if this folder is the root folder
    • getName

      public String getName()
      The name of this folder, null if this represents the root folder.
      Specified by:
      getName in interface DataFolder
      Returns:
      the name of this folder, empty or null for the root folder