Interface Mount
- All Known Subinterfaces:
 WritableMount
public interface Mount
Represents a read only part of a virtual filesystem that can be mounted onto a computer using
 
IComputerAccess.mount(String, Mount).
 Typically you will not need to implement this interface yourself, and can use the factory methods from the the main ComputerCraft API.
- 
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether a file with a given path exists or not.default BasicFileAttributesgetAttributes(String path) Get attributes about the given file.longReturns the size of a file with a given path, in bytes.booleanisDirectory(String path) Returns whether a file with a given path is a directory or not.voidReturns the file names of all the files in a directory.openForRead(String path) Opens a file with a given path, and returns aSeekableByteChannelrepresenting its contents. 
- 
Method Details
- 
exists
Returns whether a file with a given path exists or not.- Parameters:
 path- A file path in normalised format, relative to the mount location. ie: "programs/myprogram"- Returns:
 - If the file exists.
 - Throws:
 IOException- If an error occurs when checking the existence of the file.
 - 
isDirectory
Returns whether a file with a given path is a directory or not.- Parameters:
 path- A file path in normalised format, relative to the mount location. ie: "programs/myprograms".- Returns:
 - If the file exists and is a directory
 - Throws:
 IOException- If an error occurs when checking whether the file is a directory.
 - 
list
Returns the file names of all the files in a directory.- Parameters:
 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.- Throws:
 IOException- If the file was not a directory, or could not be listed.
 - 
getSize
Returns the size of a file with a given path, in bytes.- Parameters:
 path- A file path in normalised format, relative to the mount location. ie: "programs/myprogram".- Returns:
 - The size of the file, in bytes.
 - Throws:
 IOException- If the file does not exist, or its size could not be determined.
 - 
openForRead
Opens a file with a given path, and returns aSeekableByteChannelrepresenting its contents.- Parameters:
 path- A file path in normalised format, relative to the mount location. ie: "programs/myprogram".- Returns:
 - A channel representing the contents of the file.
 - Throws:
 IOException- If the file does not exist, or could not be opened.
 - 
getAttributes
Get attributes about the given file.- Parameters:
 path- The path to query.- Returns:
 - File attributes for the given file.
 - Throws:
 IOException- If the file does not exist, or attributes could not be fetched.
 
 -