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
FieldsModifier and TypeFieldDescriptionstatic final VirtualPathThe virtual root folder of the virtual file system regardless of the operating system and its native file system structure. -
Method Summary
Modifier and TypeMethodDescriptionbooleandelete(VirtualPath virtualFile) Deletes the file or directory specified by the path received as a parameter.booleanexists(VirtualPath virtualFile) Checks if the path received as a parameter already exists in the file system.intReturns the number of all the files and folders in the file system.listChildren(VirtualPath parent) Lists the files and directories that are directly under the directory specified by the path received as a parameter.booleanmkdir(VirtualPath newFile) Makes a new directory specified by the path received as a parameter.
-
Field Details
-
ROOT
The virtual root folder of the virtual file system regardless of the operating system and its native file system structure.
-
-
Method Details
-
mkdir
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:
trueif the new directory got created;falseotherwise.
-
exists
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:
trueif the specified path already exists in the file system;falseotherwise.
-
delete
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:
trueif the file or directory got deleted;falseotherwise.
-
listChildren
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.
-