Quilt Loader 1
Loading...
Searching...
No Matches
org.quiltmc.loader.api.ExtendedFiles Class Reference

Similar to Files, but for ExtendedFileSystem. More...

Static Public Member Functions

static Path copyOnWrite (Path source, Path target, CopyOption... options) throws IOException
 Copies the source file to the target file.
static Path mount (Path source, Path target, MountOption... options) throws IOException
 Attempts to mount the source file onto the target file, such that all reads and writes to the target file actually read and write the source file.
static boolean isMountedFile (Path file)
static boolean isCopyOnWrite (Path file)
static Path readMountTarget (Path file) throws IOException
 Reads the target of a mounted file, if it was created by mount(Path, Path, MountOption...).

Detailed Description

Similar to Files, but for ExtendedFileSystem.

Unlike Files, most operations can take Paths from any file system.

Member Function Documentation

◆ copyOnWrite()

Path org.quiltmc.loader.api.ExtendedFiles.copyOnWrite ( Path source,
Path target,
CopyOption... options ) throws IOException
inlinestatic

Copies the source file to the target file.

If the source file system is read-only then the target file may become a link to the source file, which is fully copied when it is modified.

This method is a safe alternative to mount(Path, Path, MountOption...), when passing them MountOption#COPY_ON_WRITE, in the sense that it will copy the file if the filesystem doesn't support mounts.

◆ isCopyOnWrite()

boolean org.quiltmc.loader.api.ExtendedFiles.isCopyOnWrite ( Path file)
inlinestatic
Returns
True if the given file was created by mount(Path, Path, MountOption...) with MountOption#COPY_ON_WRITE, and the file has not been modified since it was copied.

◆ isMountedFile()

boolean org.quiltmc.loader.api.ExtendedFiles.isMountedFile ( Path file)
inlinestatic
Returns
True if the file has been mounted with mount(Path, Path, MountOption...).

◆ mount()

Path org.quiltmc.loader.api.ExtendedFiles.mount ( Path source,
Path target,
MountOption... options ) throws IOException
inlinestatic

Attempts to mount the source file onto the target file, such that all reads and writes to the target file actually read and write the source file.

(The exact behaviour depends on the options given).

This is similar to Files#createSymbolicLink(Path, Path, java.nio.file.attribute.FileAttribute...), but the source file and target file don't need to be on the same filesystem.

This does not support mounting folders.

Exceptions
UnsupportedOperationExceptionif the filesystem doesn't support this operation.
IOExceptionif anything goes wrong while mounting the file.

◆ readMountTarget()

Path org.quiltmc.loader.api.ExtendedFiles.readMountTarget ( Path file) throws IOException
inlinestatic

Reads the target of a mounted file, if it was created by mount(Path, Path, MountOption...).

Exceptions
NotLinkExceptionif the given file is not a isMountedFile(Path).
UnsupportedOperationExceptionif this filesystem doesn't support file mounts.

The documentation for this class was generated from the following file:
  • src/main/java/org/quiltmc/loader/api/ExtendedFiles.java