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.

See Also:
  • Method Details

    • exists

      boolean exists(String path) throws IOException
      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

      boolean isDirectory(String path) throws IOException
      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

      void list(String path, List<String> contents) throws IOException
      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

      long getSize(String path) throws IOException
      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

      SeekableByteChannel openForRead(String path) throws IOException
      Opens a file with a given path, and returns a SeekableByteChannel representing 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

      default BasicFileAttributes getAttributes(String path) throws IOException
      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.