dan200.computercraft.api.filesystem

## Interface IMount

All Known Subinterfaces:
  IWritableMount

    public interface IMount

Represents a read only part of a virtual filesystem that can be mounted onto a computercraft using IComputerAccess.mount(). Ready made implementations of this interface can be created using ComputerCraftAPI.createSaveDirMount() or ComputerCraftAPI.createResourceMount(), or you're free to implement it yourselves!

See Also:
  `dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String)`, `ComputerCraftAPI.createResourceMount(Class, String, String)`, `IComputerAccess.mount(String, IMount)`, `IWritableMount`

### Method Summary

Methods
`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 it's contents.

### Method Detail

#### exists

    boolean exists(java.lang.String path)
                   throws java.io.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:
  true if the file exists, false otherwise
Throws:
  `java.io.IOException`

#### isDirectory

    boolean isDirectory(java.lang.String path)
                        throws java.io.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:
  true if the file exists and is a directory, false otherwise
Throws:
  `java.io.IOException`

#### list

    void list(java.lang.String path,
            java.util.List<java.lang.String> contents)
              throws java.io.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:
  `java.io.IOException`

#### getSize

    long getSize(java.lang.String path)
                 throws java.io.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:
  `java.io.IOException`

#### openForRead

    java.io.InputStream openForRead(java.lang.String path)
                                    throws java.io.IOException

Opens a file with a given path, and returns an inputstream representing it's contents.

Parameters:
  `path` - A file path in normalised format, relative to the mount location. ie: "programs/myprogram"
Returns:
  a stream representing the contents of the file
Throws:
  `java.io.IOException`