public class FakeFileSystem extends MutableTreeNodeObject
Usually you would start the FakeFileSystem with entries found in another file storage system like a ZipFile or a EveFile. Then the FakeFileSystem would allow data to be written into the FakeFileSystem - but the data would be written into memory and not into the original system (e.g. ZipFile).
For example, when a Eve application is being run in a WebBrowser by a Java VM, upon startup the VM looks for a file called "_filesystem.zip" on the server. If that file is found it is used as the start of the FakeFileSystem and the default file system for the application then becomes that FileSystem. Here is an excerpt from the source code that does this:
try{ eve.zip.ZipFile zf = new eve.zip.ZipFile(eve.sys.Vm.openRandomAccessStream("_filesystem.zip","r")); System.out.println("Loading virtual file system."); eve.zip.ZipEntryFile zef = new eve.zip.ZipEntryFile(zf); fileSystem = new eve.io.FakeFileSystem(); fileSystem.addVolume("Disk1",zef.getNew("/")); zf.close(); }catch(IOException e){} //No virtual file system found.
The addVolume() method is used to add a volume (simulated root drive) to the FakeFileSystem and the method getFile() returns a File object that can be used to access the FakeFileSystem.
Modifier and Type | Field and Description |
---|---|
String |
deviceName
This is the name of the File system which by default is
"Virtual File System".
|
PropertyList |
sorted |
PropertyList |
unsortedNames |
children, parent
Constructor and Description |
---|
FakeFileSystem() |
Modifier and Type | Method and Description |
---|---|
void |
addVolume(String systemName,
File root) |
String |
defaultVolume() |
int |
find(String name) |
eve.io.FakeFileSystem.FileNode |
findNode(String name) |
File |
getFile() |
static void |
main(String[] args) |
protected void |
sortNames() |
addChild, canExpand, clearChildren, collapse, expand, getChild, getChildCount, getChildren, getParent, indexOfChild, insertChild, isLeaf, removeChild, setParent
public String deviceName
public PropertyList unsortedNames
public PropertyList sorted