Interface VirtualFileSystem

All Known Implementing Classes:
DefaultVirtualFileSystem

public interface VirtualFileSystem
The interface for virtual file system implementations. Provides the methods for the basic file system functionality.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final VirtualPath
    The virtual root folder of the virtual file system regardless of the operating system and its native file system structure.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    delete(VirtualPath virtualFile)
    Deletes the file or directory specified by the path received as a parameter.
    boolean
    exists(VirtualPath virtualFile)
    Checks if the path received as a parameter already exists in the file system.
    int
    Returns the number of all the files and folders in the file system.
    Lists the files and directories that are directly under the directory specified by the path received as a parameter.
    boolean
    mkdir(VirtualPath newFile)
    Makes a new directory specified by the path received as a parameter.
  • Field Details

    • ROOT

      static final VirtualPath ROOT
      The virtual root folder of the virtual file system regardless of the operating system and its native file system structure.
  • Method Details

    • mkdir

      boolean mkdir(VirtualPath newFile)
      Makes a new directory specified by the path received as a parameter.
      Parameters:
      newFile - The path that points to the directory that should be created.
      Returns:
      true if the new directory got created; false otherwise.
    • exists

      boolean exists(VirtualPath virtualFile)
      Checks if the path received as a parameter already exists in the file system.
      Parameters:
      virtualFile - The path that may or may not exist in the file system.
      Returns:
      true if the specified path already exists in the file system; false otherwise.
    • delete

      boolean delete(VirtualPath virtualFile)
      Deletes the file or directory specified by the path received as a parameter.
      Parameters:
      virtualFile - The path pointing to the file or directory that should be deleted.
      Returns:
      true if the file or directory got deleted; false otherwise.
    • listChildren

      List<VirtualPath> listChildren(VirtualPath parent)
      Lists the files and directories that are directly under the directory specified by the path received as a parameter.
      Parameters:
      parent - The path specifying the directory the contents of which should be listed.
      Returns:
      The list of paths that point to the contents of the parent directory.
    • getTotalNumberOfFiles

      int getTotalNumberOfFiles()
      Returns the number of all the files and folders in the file system.
      Returns:
      The number of files and folders in the file system.