Class FileSystem
java.lang.Object
com.blackrook.fs.FileSystem
This is a virtual file system layer for applications and
other projects that resolve resources from virtual and nonvirtual
file systems and archives.
- Author:
- Matthew Tropiano
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LinkedList<FSFileArchive> Lookup stack for file system. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArchive(FSFileArchive fsfa) Adds an archive to the bottom of the search stack.createFile(String path) Creates a file in this system using the name and path provided.FSFile[]getAllFileInstances(String path) Retrieves all of the instances of a file from the system.FSFile[]Retrieves all of the recent instances of a file from the system.FSFile[]getAllFiles(FSFileFilter filter) Retrieves all of the recent instances of the files within this system that pass the filter test as FSFile objects.FSFile[]getAllFilesInDir(String path) Retrieves all of the recent instances of the files within this system as FSFile objects.FSFile[]getAllFilesInDir(String path, FSFileFilter filter) Retrieves all of the recent instances of the files within this system that pass the filter test as FSFile objects.Retrieves a file from the system.Pops an archive off of the search stack.voidpushArchive(FSFileArchive fsfa) Pushes an archive onto the search stack.booleanremoveArchive(FSFileArchive fsfa) Removes an archive from the search stack.
-
Field Details
-
fileStack
Lookup stack for file system.
-
-
Constructor Details
-
FileSystem
public FileSystem()Creates and initializes a new FileSystem.
-
-
Method Details
-
addArchive
Adds an archive to the bottom of the search stack.- Parameters:
fsfa- the archive to add.
-
removeArchive
Removes an archive from the search stack.- Parameters:
fsfa- the archive to remove.- Returns:
- true if removed, false if not.
-
pushArchive
Pushes an archive onto the search stack.- Parameters:
fsfa- the archive to push.
-
popArchive
Pops an archive off of the search stack.- Returns:
- what used to be the topmost archive on the stack.
-
getFile
Retrieves a file from the system. Searches down the stack.- Parameters:
path- the file path.- Returns:
- A reference to the file as an FSFile object, null if not found.
- Throws:
IOException- if a read error occurs during the fetch.
-
getAllFileInstances
Retrieves all of the instances of a file from the system. Searches down the stack.- Parameters:
path- the file path.- Returns:
- A reference to the files as an FSFile array object. An empty array implies that no files were found.
- Throws:
IOException- if a read error occurs during the fetch.
-
getAllFiles
Retrieves all of the recent instances of a file from the system. Searches down the stack.- Returns:
- A reference to the files as an FSFile array object.
- Throws:
IOException- if a read error occurs during the fetch.
-
getAllFiles
Retrieves all of the recent instances of the files within this system that pass the filter test as FSFile objects.- Parameters:
filter- the file filter to use.- Returns:
- A reference to the files as an FSFile array object.
- Throws:
IOException- if a read error occurs during the fetch.
-
getAllFilesInDir
Retrieves all of the recent instances of the files within this system as FSFile objects.- Parameters:
path- the file path. Must be a directory.- Returns:
- A reference to the files as an FSFile array object.
- Throws:
IOException- if a read error occurs during the fetch.
-
getAllFilesInDir
Retrieves all of the recent instances of the files within this system that pass the filter test as FSFile objects.- Parameters:
path- the file path. Must be a directory.filter- the file filter to use.- Returns:
- A reference to the files as an FSFile array object.
- Throws:
IOException- if a read error occurs during the fetch.
-
createFile
Creates a file in this system using the name and path provided. The file is created off of the topmost archive that can create files.- Parameters:
path- the path if the file to create.- Returns:
- an acceptable OutputStream for filling the file with data, or null if no stream can be made.
- Throws:
IOException- if a read error occurs during the fetch.- See Also:
-