li.cil.oc.api
public final class FileSystem extends java.lang.Object
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, li.cil.oc.api.fs.Label, net.minecraft.tileentity.TileEntity) or its overloads will appear as
filesystem components in the component network. Note that the
component's visibility is set to Neighbors per default. If you wish
to change the file system's visibility (e.g. like the disk drive does) you
must cast the environment's node to Component
and set the visibility to the desired value.
Note that these methods should not be called in the pre-init phase,
since the instance may not have been initialized at that time. Only
start calling these methods in the init phase or later.| Modifier and Type | Field and Description |
|---|---|
static FileSystemAPI |
instance |
| Modifier and Type | Method and Description |
|---|---|
static ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem)
Like
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label),
but creates an unlabeled file system (i.e. |
static ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
Label label)
Like
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label, TileEntity),
but does not provide a container. |
static ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
Label label,
net.minecraft.tileentity.TileEntity container)
Creates a network node that makes the specified file system available via
the common file system driver.
|
static 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. |
static ManagedEnvironment |
asManagedEnvironment(FileSystem fileSystem,
java.lang.String label,
net.minecraft.tileentity.TileEntity container)
Like
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label, TileEntity),
but creates a read-only label initialized to the specified value. |
static 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.
|
static FileSystem |
fromComputerCraft(dan200.computer.api.IMount mount)
Creates a new file system based on a read-only ComputerCraft mount.
|
static FileSystem |
fromComputerCraft(dan200.computer.api.IWritableMount mount)
Creates a new file system based on a read-write ComputerCraft mount.
|
static FileSystem |
fromComputerCraft(dan200.computercraft.api.filesystem.IMount mount)
Creates a new file system based on a read-only ComputerCraft mount.
|
static FileSystem |
fromComputerCraft(dan200.computercraft.api.filesystem.IWritableMount mount)
Creates a new file system based on a read-write ComputerCraft mount.
|
static FileSystem |
fromMemory(long capacity)
Creates a new writable file system that resides in memory.
|
static FileSystem |
fromSaveDirectory(java.lang.String root,
long capacity)
Same as
fromSaveDirectory(String, long, boolean) with the
buffered parameter being true, i.e. |
static FileSystem |
fromSaveDirectory(java.lang.String root,
long capacity,
boolean buffered)
Creates a new writable file system in the save folder.
|
public static FileSystemAPI instance
public static 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.public static 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.public static FileSystem fromSaveDirectory(java.lang.String root, long capacity)
fromSaveDirectory(String, long, boolean) with the
buffered parameter being true, i.e. will always create a
buffered file system.root - the name of the file system.capacity - the amount of space in bytes to allow being used.public static FileSystem fromMemory(long capacity)
capacity - the capacity of the file system.public static FileSystem fromComputerCraft(dan200.computer.api.IMount mount)
mount - the mount to wrap with a file system.public static FileSystem fromComputerCraft(dan200.computer.api.IWritableMount mount)
mount - the mount to wrap with a file system.public static FileSystem fromComputerCraft(dan200.computercraft.api.filesystem.IMount mount)
mount - the mount to wrap with a file system.public static FileSystem fromComputerCraft(dan200.computercraft.api.filesystem.IWritableMount mount)
mount - the mount to wrap with a file system.public static ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label, net.minecraft.tileentity.TileEntity container)
fileSystem - the file system to wrap.label - the label of the file system.container - the tile entity containing the file system.public static ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, java.lang.String label, net.minecraft.tileentity.TileEntity container)
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label, TileEntity),
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.public static ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label)
asManagedEnvironment(li.cil.oc.api.fs.FileSystem, Label, TileEntity),
but does not provide a container.fileSystem - the file system to wrap.label - the label of the file system.public static 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.public static 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.