public interface FileSystemAPI
| Modifier and Type | Method and Description |
|---|---|
ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem)
Like
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label),
but creates an unlabeled file system (i.e. |
ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
Label label)
Like
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label, Container),
but does not provide a container. |
ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
Label label,
Container container)
Creates a network node that makes the specified file system available via
the common file system driver.
|
ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
java.lang.String label)
Like
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label),
but creates a read-only label initialized to the specified value. |
ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
java.lang.String label,
Container container)
Like
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label, Container),
but creates a read-only label initialized to the specified value. |
FileSystem |
fromClass(java.lang.Class<?> clazz,
java.lang.String domain,
java.lang.String root)
Creates a new file system based on the location of a class.
|
FileSystem |
fromComputerCraft(java.lang.Object mount)
Creates a new file system based on a read-only ComputerCraft mount.
|
FileSystem |
fromMemory(long capacity)
Creates a new writable file system that resides in memory.
|
FileSystem |
fromSaveDirectory(java.lang.String root,
long capacity,
boolean buffered)
Creates a new writable file system in the save folder.
|
FileSystem fromClass(java.lang.Class<?> clazz, java.lang.String domain, java.lang.String root)
"/assets/" + domain + "/" + rootIf the class is located in a JAR file, this will create a read-only file system based on that JAR file. If the class file is located in the native file system, this will create a read-only file system first trying from the actual location of the class file, and failing that by searching the class path (i.e. it'll look for a path constructed as described above). If the specified path cannot be located, the creation fails and this returns null.
clazz - the class whose containing JAR to wrap.domain - the domain, usually your mod's ID.root - an optional subdirectory.FileSystem fromSaveDirectory(java.lang.String root, long capacity, boolean buffered)
"saves/" + WORLD_NAME + "/opencomputers/" + rootThe first part may differ, in particular for servers. Usually the name will be the address of the node used to represent the file system. Note that by default file systems are "buffered", meaning that any changes made to them are only saved to disk when the world is saved. This ensured that the file system contents do not go "out of sync" when the game crashes, but introduces additional memory overhead, since all files in the file system have to be kept in memory.
root - the name of the file system.capacity - the amount of space in bytes to allow being used.buffered - whether data should only be written to disk when saving.FileSystem fromMemory(long capacity)
capacity - the capacity of the file system.FileSystem fromComputerCraft(java.lang.Object mount)
mount - the mount to wrap with a file system.ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label, Container container)
fileSystem - the file system to wrap.label - the label of the file system.container - the tile entity containing the file system.ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, java.lang.String label, Container container)
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label, Container),
but creates a read-only label initialized to the specified value.fileSystem - the file system to wrap.label - the read-only label of the file system.ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label)
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label, Container),
but does not provide a container.fileSystem - the file system to wrap.label - the label of the file system.ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, java.lang.String label)
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label),
but creates a read-only label initialized to the specified value.fileSystem - the file system to wrap.label - the read-only label of the file system.ManagedEnvironment asManagedEnvironment(FileSystem fileSystem)
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label),
but creates an unlabeled file system (i.e. the label can neither be read
nor written).fileSystem - the file system to wrap.