public interface IMount
IComputerAccess.mount(String, IMount)
Ready made implementations of this interface can be created using
ComputerCraftAPI.createSaveDirMount(World, String, long)
or
ComputerCraftAPI.createResourceMount(Class, String, String)
, or you're free to implement it yourselves!Modifier and Type | Method and Description |
---|---|
boolean |
exists(java.lang.String path)
Returns whether a file with a given path exists or not.
|
long |
getSize(java.lang.String path)
Returns the size of a file with a given path, in bytes
|
boolean |
isDirectory(java.lang.String path)
Returns whether a file with a given path is a directory or not.
|
void |
list(java.lang.String path,
java.util.List<java.lang.String> contents)
Returns the file names of all the files in a directory.
|
java.io.InputStream |
openForRead(java.lang.String path)
Opens a file with a given path, and returns an
InputStream representing its contents. |
boolean exists(java.lang.String path) throws java.io.IOException
path
- A file path in normalised format, relative to the mount location. ie: "programs/myprogram"java.io.IOException
- If an error occurs when checking the existence of the file.boolean isDirectory(java.lang.String path) throws java.io.IOException
path
- A file path in normalised format, relative to the mount location. ie: "programs/myprograms".java.io.IOException
- If an error occurs when checking whether the file is a directory.void list(java.lang.String path, java.util.List<java.lang.String> contents) throws java.io.IOException
path
- A file path in normalised format, relative to the mount location. ie: "programs/myprograms".contents
- A list of strings. Add all the file names to this list.java.io.IOException
- If the file was not a directory, or could not be listed.long getSize(java.lang.String path) throws java.io.IOException
path
- A file path in normalised format, relative to the mount location. ie: "programs/myprogram".java.io.IOException
- If the file does not exist, or its size could not be determined.java.io.InputStream openForRead(java.lang.String path) throws java.io.IOException
InputStream
representing its contents.path
- A file path in normalised format, relative to the mount location. ie: "programs/myprogram".java.io.IOException
- If the file does not exist, or could not be opened.