saker.build Documentation TaskDoc JavaDoc
@RMIWrap(LocalFileProvider.LocalFilesRMIWrapper.class)
public final class LocalFileProvider implements SakerFileProvider
Root file provider backed by the local file system.

The local file provider operates on Paths and uses the local FileSystem instance for modifying the files. The instance is retrieved using FileSystems.getDefault().

Some methods in this class can accept Path instead of SakerPath. The passed paths should all be bound to the default filesystem, if they're not, an InvalidPathFormatException is thrown.

Singleton.

Methods
public ListenerToken
Adds a file event listener for the specified directory.
public ListenerToken
Adds a file event listener for the specified directory.
public void
Clears the directory and all subdirectories at the specified path.
public void
Clears the directory and all subdirectories at the specified path.
public void
Creates the directory and necessary parent directors at the given path.
public void
Creates the directory and necessary parent directors at the given path.
public void
delete(Path path)
Deletes a file or directory at the given path.
public void
Deletes a file or directory at the given path.
public Set<String>
Deletes the children of a directory recursively, if the name of a given child is not in the specified set.
public Set<String>
Deletes the children of a directory recursively, if the name of a given child is not in the specified set.
public void
Deletes a file or directory at the given path, recursively if it is a directory.
public void
Deletes a file or directory at the given path, recursively if it is a directory.
public int
Deletes the file at the given path if the type of it is not the specified one.
public int
Deletes the file at the given path if the type of it is not the specified one.
public int
ensureWriteRequest(Path path, int filetype, int opflag)
Ensures that a write request to the given path can be initiated with the given type.
public int
ensureWriteRequest(SakerPath path, int filetype, int opflag)
Ensures that a write request to the given path can be initiated with the given type.
public ByteArrayRegion
getAllBytes(Path path, OpenOption... openoptions)
Gets all of the byte contents of the file at the specified path.
public ByteArrayRegion
getAllBytes(SakerPath path, OpenOption... openoptions)
Gets all of the byte contents of the file at the specified path.
public NavigableMap<String, ? extends FileEntry>
Gets the entries in the directory denoted by the argument path.
public NavigableMap<String, ? extends FileEntry>
Gets the entries in the directory denoted by the argument path.
public NavigableMap<SakerPath, ? extends FileEntry>
Collects the entries in the specified directory, recursively.
public NavigableMap<SakerPath, ? extends FileEntry>
Collects the entries in the specified directory, recursively.
public Entry<String, ? extends FileEntry>
Gets the attributes of a file in the directory specified by the argument path.
public Entry<String, ? extends FileEntry>
Gets the attributes of a file in the directory specified by the argument path.
public NavigableSet<String>
Gets the names of the files present in the directory denoted by the specified path.
public NavigableSet<String>
Gets the names of the files present in the directory denoted by the specified path.
public FileEntry
getFileAttributes(Path file, LinkOption... linkoptions)
Gets the attributes of the file at the specified path.
public FileEntry
getFileAttributes(SakerPath path, LinkOption... linkoptions)
Gets the attributes of the file at the specified path.
public static LocalFileProvider
Gets the singleton instance for the local file system.
public ProviderHolderPathKey
Creates a path key for the given path and this file provider.
public ProviderHolderPathKey
Creates a path key for the given path and this file provider.
public static PathKey
Creates a path key for the given path and the local file provider key.
public static PathKey
Creates a path key for the given path and the local file provider key.
public RootFileProviderKey
Gets the file provider key for this file provider.
public static RootFileProviderKey
Same as getProviderKey(), but can be called statically.
public Set<String>
Gets the file system roots of this file provider.
public Set<String>
Gets the names of subdirectories in the directory denoted by the specified path.
public Set<String>
Gets the names of subdirectories in the directory denoted by the specified path.
public FileHashResult
hash(Path path, String algorithm, OpenOption... openoptions)
Creates a hash using the specified algorithm based on the contents of the file at the specified path.
public FileHashResult
hash(SakerPath path, String algorithm, OpenOption... openoptions)
Creates a hash using the specified algorithm based on the contents of the file at the specified path.
public boolean
isChanged(Path path, long size, long modificationmillis, LinkOption... linkoptions)
Checks if the given attributes of a file at the specified path are the same or not.
public boolean
isChanged(SakerPath path, long size, long modificationmillis, LinkOption... linkoptions)
Checks if the given attributes of a file at the specified path are the same or not.
public void
moveFile(Path source, Path target, CopyOption... copyoptions)
Moves a file from on location to another.
public void
moveFile(SakerPath source, SakerPath target, CopyOption... copyoptions)
Moves a file from on location to another.
public ByteSource
openInput(Path path, OpenOption... openoptions)
Opens an input stream to the file at the specified path.
public ByteSource
openInput(SakerPath path, OpenOption... openoptions)
Opens an input stream to the file at the specified path.
public InputStream
openInputStream(Path path, OpenOption... openoptions)
Opens an input stream to the file at the specified path.
public InputStream
openInputStream(SakerPath path, OpenOption... openoptions)
public ByteSink
openOutput(Path path, OpenOption... openoptions)
Opens an output stream to the file at the specified path.
public ByteSink
openOutput(SakerPath path, OpenOption... openoptions)
Opens an output stream to the file at the specified path.
public OutputStream
openOutputStream(Path path, OpenOption... openoptions)
Opens an output stream to the file at the specified path.
public OutputStream
openOutputStream(SakerPath path, OpenOption... openoptions)
Opens an output stream to the file at the specified path.
public void
Removes the file listeners in a bulk operation.
public static Path
Validation method for ensuring that the argument path is absolute and associated with the local file system.
public void
setLastModifiedMillis(Path path, long millis)
Sets the last modified time of the file at the given path.
public void
setLastModifiedMillis(SakerPath path, long millis)
Sets the last modified time of the file at the given path.
public void
Sets the last modified time of the file at the given path.
public static Path
Converts the argument absolute path to a local Path for the local file system.
public String
Returns a string representation of the object.
public long
writeTo(Path path, ByteSink out, OpenOption... openoptions)
Writes the contents of the file at the given path to the specified output stream.
public long
writeTo(SakerPath path, ByteSink out, OpenOption... openoptions)
Writes the contents of the file at the given path to the specified output stream.
public long
writeToFile(InputStream is, Path path, OpenOption... openoptions)
Writes the contents from the given input stream to the specified output file path.
public long
writeToStream(Path path, OutputStream os, OpenOption... openoptions)
Writes the contents of the file at the given path to the specified output stream.
Documentation included from: SakerFileProvider
Adds a file event listener for the specified directory.

If the specified directory doesn't exist, the provider can either fail or succeed for installing the listener.

Callers should keep a strong reference to the returned token, and call FileEventListener.ListenerToken.removeListener() when the listener is no longer needed. Removing all references to the returned token is not sufficient for removing the listener from the provider.

Listeners might receive events before this method finishes.

The listener will receive file event changes with file names which are a children of the specified directory.

directoryThe directory to install the listener to.
listenerThe listener to install.
The token for the installed listener.
IOExceptionIf the provider failed to install the listener.
Overridden from: SakerFileProvider
Adds a file event listener for the specified directory.

If the specified directory doesn't exist, the provider can either fail or succeed for installing the listener.

Callers should keep a strong reference to the returned token, and call FileEventListener.ListenerToken.removeListener() when the listener is no longer needed. Removing all references to the returned token is not sufficient for removing the listener from the provider.

Listeners might receive events before this method finishes.

The listener will receive file event changes with file names which are a children of the specified directory.

directoryThe directory to install the listener to.
listenerThe listener to install.
The token for the installed listener.
IOExceptionIf the provider failed to install the listener.
public void clearDirectoryRecursively(Path directory) throws IOException
Documentation included from: SakerFileProvider
Clears the directory and all subdirectories at the specified path.

This method follows symbolic links for retrieving the children, but doesn't when deleting the entries. Meaning, if a directory contains a link, the link will be deleted and the directory at the end of the link will not be cleared.

directoryThe path to the directory to clear.
IOExceptionIn case of I/O error.
Overridden from: SakerFileProvider
Clears the directory and all subdirectories at the specified path.

This method follows symbolic links for retrieving the children, but doesn't when deleting the entries. Meaning, if a directory contains a link, the link will be deleted and the directory at the end of the link will not be cleared.

pathThe path to the directory to clear.
IOExceptionIn case of I/O error.
Documentation included from: SakerFileProvider
Creates the directory and necessary parent directors at the given path.

If the directories cannot be created due to a non-directory file is already present at the path or at one of its parent paths, the method will fail.

pathThe path to create the directory at.
FileAlreadyExistsExceptionIf there is already a non-directory file at the path (or any parent paths).
IOExceptionIn case of I/O error.
public void createDirectories(SakerPath path) throws IOException
Overridden from: SakerFileProvider
Creates the directory and necessary parent directors at the given path.

If the directories cannot be created due to a non-directory file is already present at the path or at one of its parent paths, the method will fail.

pathThe path to create the directory at.
IOExceptionIn case of I/O error.
Documentation included from: SakerFileProvider
Deletes a file or directory at the given path.

The method will fail if the path denotes a directory and it is not empty.

If the path denotes a symbolic link, only the link will be deleted.

If there is no file at the given path, the method will succeed, and won't throw an exception. Therefore this methods works in the manner of "delete if exists".

pathThe path to delete.
IOExceptionIn case of I/O error.
DirectoryNotEmptyExceptionIf the path denotes a file and it's not empty.
Overridden from: SakerFileProvider
Deletes a file or directory at the given path.

The method will fail if the path denotes a directory and it is not empty.

If the path denotes a symbolic link, only the link will be deleted.

If there is no file at the given path, the method will succeed, and won't throw an exception. Therefore this methods works in the manner of "delete if exists".

pathThe path to delete.
IOExceptionIn case of I/O error.
DirectoryNotEmptyExceptionIf the path denotes a file and it's not empty.
public Set<String> deleteChildrenRecursivelyIfNotIn(Path path, Set<String> childfilenames) throws IOException
Documentation included from: SakerFileProvider
Deletes the children of a directory recursively, if the name of a given child is not in the specified set.

If a directory child is a directory, it will be recursively deleted, meaning any of its subdirectories will be deleted too.

This method doesn't follow symbolic links. Meaning, if a directory contains a link, the link will be deleted and the directory at the end of the link will not be cleared.

pathThe path to the directory.
childfilenamesA set of names in the specified directory to not delete.
The names of the actually deleted files.
IOExceptionIn case of I/O error.
Overridden from: SakerFileProvider
Deletes the children of a directory recursively, if the name of a given child is not in the specified set.

If a directory child is a directory, it will be recursively deleted, meaning any of its subdirectories will be deleted too.

This method doesn't follow symbolic links. Meaning, if a directory contains a link, the link will be deleted and the directory at the end of the link will not be cleared.

pathThe path to the directory.
childfilenamesA set of names in the specified directory to not delete.
The names of the actually deleted files.
IOExceptionIn case of I/O error.
public void deleteRecursively(Path path) throws IOException
Documentation included from: SakerFileProvider
Deletes a file or directory at the given path, recursively if it is a directory.

This method will delete all files at the given path, clearing the directory beforehand if necessary.

This method doesn't follow symbolic links. Links to directories will be deleted, the directories won't be cleared if they are not under the specified path.

pathThe path to delete.
IOExceptionIn case of I/O error.
public void deleteRecursively(SakerPath path) throws IOException
Overridden from: SakerFileProvider
Deletes a file or directory at the given path, recursively if it is a directory.

This method will delete all files at the given path, clearing the directory beforehand if necessary.

This method doesn't follow symbolic links. Links to directories will be deleted, the directories won't be cleared if they are not under the specified path.

pathThe path to delete.
IOExceptionIn case of I/O error.
public int deleteRecursivelyIfNotFileType(Path path, int filetype) throws IOException
Documentation included from: SakerFileProvider
Deletes the file at the given path if the type of it is not the specified one.

This method reads the attributes at the given path, and deletes the file recursively if it doesn't match the expected.

The attribute reading follows symbolic links, the deletion doesn't.

The file type argument should be one of the file type constants in FileEntry.

pathThe path to the file.
filetypeThe expected file type.
The current file type at the path. Either same as the argument, or FileEntry.TYPE_NULL to signal that it was deleted.
IOExceptionIn case of I/O error.
public int deleteRecursivelyIfNotFileType(SakerPath path, int filetype) throws IOException
Overridden from: SakerFileProvider
Deletes the file at the given path if the type of it is not the specified one.

This method reads the attributes at the given path, and deletes the file recursively if it doesn't match the expected.

The attribute reading follows symbolic links, the deletion doesn't.

The file type argument should be one of the file type constants in FileEntry.

pathThe path to the file.
filetypeThe expected file type.
The current file type at the path. Either same as the argument, or FileEntry.TYPE_NULL to signal that it was deleted.
IOExceptionIn case of I/O error.
public int ensureWriteRequest(Path path, int filetype, int opflag) throws IOException
Documentation included from: SakerFileProvider
Ensures that a write request to the given path can be initiated with the given type.

This method examines the current file at the given path, and ensures that the file is either has the same type, or a write request can be initiated to it.

The argument file type and behaviour based on it is the following:

  • FileEntry.TYPE_FILE: If there is a directory at the path, it will be deleted recursively*. If there is a file at the path, no operation will be done as it can be overwritten. If not all parent directories exist at the path, the parent directories will be created recursively. This ensures that a following SakerFileProvider.openOutput(SakerPath, OpenOption...) can succeed.
    * If the SakerFileProvider.OPERATION_FLAG_NO_RECURSIVE_DIRECTORY_DELETE is specified, the encountered directory will only be deleted if it is empty. An exception is thrown instead if it is not empty.
  • FileEntry.TYPE_DIRECTORY: If there is a non-directory file at the path, it will be deleted. If there is a directory at the path, no operation will be done. If there is no file at the path, all directories will be created, including the one at the path as well.
The directory creation for parent paths in the above behaviours works the same way as SakerFileProvider.createDirectories(SakerPath).

This method is mainly useful to batch the attribute reading-deletion-file creation operations into one call, therefore ensuring that a given path is writeable for the given file type.

Note that this function is not atomic. The checking of the currently present file, deletions, and creation are not done atomically, therefore this method may fail if concurrent modifications distrupt it. It is recommended for callers to ensure private and synchronized access to the given path.

pathThe path.
filetypeThe file type to ensure the write request for.
opflagThe operation flag to take into account. Acceptable flags: OPERATION_FLAG_NO_RECURSIVE_DIRECTORY_DELETE, OPERATION_FLAG_DELETE_INTERMEDIATE_FILES.
The result flags describing the changes made by this method. See RESULT_NO_CHANGES, RESULT_FLAG_FILES_DELETED, RESULT_FLAG_DIRECTORY_CREATED.
IOExceptionIn case of I/O error.
public int ensureWriteRequest(SakerPath path, int filetype, int opflag) throws IOException
Overridden from: SakerFileProvider
Ensures that a write request to the given path can be initiated with the given type.

This method examines the current file at the given path, and ensures that the file is either has the same type, or a write request can be initiated to it.

The argument file type and behaviour based on it is the following:

  • FileEntry.TYPE_FILE: If there is a directory at the path, it will be deleted recursively*. If there is a file at the path, no operation will be done as it can be overwritten. If not all parent directories exist at the path, the parent directories will be created recursively. This ensures that a following SakerFileProvider.openOutput(SakerPath, OpenOption...) can succeed.
    * If the SakerFileProvider.OPERATION_FLAG_NO_RECURSIVE_DIRECTORY_DELETE is specified, the encountered directory will only be deleted if it is empty. An exception is thrown instead if it is not empty.
  • FileEntry.TYPE_DIRECTORY: If there is a non-directory file at the path, it will be deleted. If there is a directory at the path, no operation will be done. If there is no file at the path, all directories will be created, including the one at the path as well.
The directory creation for parent paths in the above behaviours works the same way as SakerFileProvider.createDirectories(SakerPath).

This method is mainly useful to batch the attribute reading-deletion-file creation operations into one call, therefore ensuring that a given path is writeable for the given file type.

Note that this function is not atomic. The checking of the currently present file, deletions, and creation are not done atomically, therefore this method may fail if concurrent modifications distrupt it. It is recommended for callers to ensure private and synchronized access to the given path.

pathThe path.
filetypeThe file type to ensure the write request for.
opflagThe operation flag to take into account. Acceptable flags: OPERATION_FLAG_NO_RECURSIVE_DIRECTORY_DELETE, OPERATION_FLAG_DELETE_INTERMEDIATE_FILES.
The result flags describing the changes made by this method. See RESULT_NO_CHANGES, RESULT_FLAG_FILES_DELETED, RESULT_FLAG_DIRECTORY_CREATED.
IOExceptionIn case of I/O error.
public ByteArrayRegion getAllBytes(Path path, OpenOption... openoptions) throws IOException
Documentation included from: SakerFileProvider
Gets all of the byte contents of the file at the specified path.
pathThe path to the file.
openoptionsThe opening options for the input.
The byte contents of the file.
IOExceptionIn case of I/O error.
public ByteArrayRegion getAllBytes(SakerPath path, OpenOption... openoptions) throws IOException
Overridden from: SakerFileProvider
Gets all of the byte contents of the file at the specified path.
pathThe path to the file.
openoptionsThe opening options for the input.
The byte contents of the file.
IOExceptionIn case of I/O error.
Documentation included from: SakerFileProvider
Gets the entries in the directory denoted by the argument path.

The result contains the file names mapped to their attributes.

This method follows symbolic links when determining the attributes.

pathThe path to the directory.
The directory entries.
IOExceptionIn case of I/O error.
Overridden from: SakerFileProvider
Gets the entries in the directory denoted by the argument path.

The result contains the file names mapped to their attributes.

This method follows symbolic links when determining the attributes.

pathThe path to the directory.
The directory entries.
IOExceptionIn case of I/O error.
Documentation included from: SakerFileProvider
Collects the entries in the specified directory, recursively.

This method contains every file entry that is under the specified directory and its subdirectories.

Use this method judiciously as a large number of files might be queried.

The file attribute values in the result map are mapped to their relative path based on the argument path.

This method follows symbolic links for directories and when determining attributes.

pathThe path to the directory.
The recursively collected file entries mapped to their paths relative to the argument.
IOExceptionIn case of I/O error.
Overridden from: SakerFileProvider
Collects the entries in the specified directory, recursively.

This method contains every file entry that is under the specified directory and its subdirectories.

Use this method judiciously as a large number of files might be queried.

The file attribute values in the result map are mapped to their relative path based on the argument path.

This method follows symbolic links for directories and when determining attributes.

pathThe path to the directory.
The recursively collected file entries mapped to their paths relative to the argument.
IOExceptionIn case of I/O error.
Documentation included from: SakerFileProvider
Gets the attributes of a file in the directory specified by the argument path.

This method only returns non-null if there is a directory at the denoted path, and in that directory there is only one file. The attributes for the file is returned.

This method follows symbolic links when determining the attribute.

pathThe directory to get the entry for.
A map entry where the key is the name of the found file, the value is the attributes of the file. null if no file or more than one was found.
IOExceptionIn case of I/O error.
Overridden from: SakerFileProvider
Gets the attributes of a file in the directory specified by the argument path.

This method only returns non-null if there is a directory at the denoted path, and in that directory there is only one file. The attributes for the file is returned.

This method follows symbolic links when determining the attribute.

pathThe directory to get the entry for.
A map entry where the key is the name of the found file, the value is the attributes of the file. null if no file or more than one was found.
IOExceptionIn case of I/O error.
Documentation included from: SakerFileProvider
Gets the names of the files present in the directory denoted by the specified path.

This method doesn't follow symbolic links.

pathThe path to the directory.
A set of file names which are present in the given directory.
IOExceptionIn case of I/O error.
Overridden from: SakerFileProvider
Gets the names of the files present in the directory denoted by the specified path.

This method doesn't follow symbolic links.

pathThe path to the directory.
A set of file names which are present in the given directory.
IOExceptionIn case of I/O error.
public FileEntry getFileAttributes(Path file, LinkOption... linkoptions) throws IOException
Documentation included from: SakerFileProvider
Gets the attributes of the file at the specified path.
fileThe path to the file.
linkoptionsLink options to use when retrieving the attributes.
The attributes of the file.
IOExceptionIn case of I/O error.
public FileEntry getFileAttributes(SakerPath path, LinkOption... linkoptions) throws IOException
Overridden from: SakerFileProvider
Gets the attributes of the file at the specified path.
pathThe path to the file.
linkoptionsLink options to use when retrieving the attributes.
The attributes of the file.
IOExceptionIn case of I/O error.
Gets the singleton instance for the local file system.
The file provider instance.
Creates a path key for the given path and this file provider.
pathThe path.
The created path key.
Creates a path key for the given path and this file provider.
pathThe path.
The created path key.
public static PathKey getPathKeyStatic(Path path)
Creates a path key for the given path and the local file provider key.
pathThe path.
The created path key.
public static PathKey getPathKeyStatic(SakerPath path)
Creates a path key for the given path and the local file provider key.
pathThe path.
The created path key.
Overridden from: SakerFileProvider
Gets the file provider key for this file provider.

If this file provider is a root provider, then the result will be an instance of RootFileProviderKey.

The file provider key.
Same as getProviderKey(), but can be called statically.
The file provider key.
public Set<String> getRoots()
Overridden from: SakerFileProvider
Gets the file system roots of this file provider.

File system roots do not change during the lifetime of a file provider. They are normalized according to the rules of SakerPath.normalizeRoot(String).

Note: It can happen that some file system drives are changed during the lifetime of a file provider. (E.g. USB drive inserted/removed, etc...) The file provider implementations are not required to recognize these changes, and restarting the build system process might be required to handle the file system changes.

An unmodifiable set of root names for this file provider.
Documentation included from: SakerFileProvider
Gets the names of subdirectories in the directory denoted by the specified path.

This method follows symbolic links when determining if an entry is considered a directory.

pathThe path to the directory.
A set of directory names which are present in the given directory.
IOExceptionIn case of I/O error.
Overridden from: SakerFileProvider
Gets the names of subdirectories in the directory denoted by the specified path.

This method follows symbolic links when determining if an entry is considered a directory.

pathThe path to the directory.
A set of directory names which are present in the given directory.
IOExceptionIn case of I/O error.
public FileHashResult hash(Path path, String algorithm, OpenOption... openoptions) throws NoSuchAlgorithmException, IOException
Documentation included from: SakerFileProvider
Creates a hash using the specified algorithm based on the contents of the file at the specified path.

This method will read the contents of the file at the specified path and use the appropriate MessageDigest to create a hash of its contents.

When using RMI, it is preferable to call this method instead of opening the stream on client side and reading the contents, as it can avoid transferring the whole content of the file over the network.

pathThe path to the file.
algorithmThe algorithm to use for hashing.
openoptionsThe opening options to use when opening the file.
The computed hash.
NoSuchAlgorithmExceptionIf the hashing algorithm not found.
IOExceptionIn case of I/O error.
public FileHashResult hash(SakerPath path, String algorithm, OpenOption... openoptions) throws NoSuchAlgorithmException, IOException
Overridden from: SakerFileProvider
Creates a hash using the specified algorithm based on the contents of the file at the specified path.

This method will read the contents of the file at the specified path and use the appropriate MessageDigest to create a hash of its contents.

When using RMI, it is preferable to call this method instead of opening the stream on client side and reading the contents, as it can avoid transferring the whole content of the file over the network.

pathThe path to the file.
algorithmThe algorithm to use for hashing.
openoptionsThe opening options to use when opening the file.
The computed hash.
NoSuchAlgorithmExceptionIf the hashing algorithm not found.
IOExceptionIn case of I/O error.
public boolean isChanged(Path path, long size, long modificationmillis, LinkOption... linkoptions)
Documentation included from: SakerFileProvider
Checks if the given attributes of a file at the specified path are the same or not.

This method retrieves the attributes of the file at the path and compares the specified attributes.

pathThe path to the file.
sizeThe expected size of the file.
modificationmillisThe expected modification time of the file.
linkoptionsThe link options to use.
true if failed to retrieve the attributes, or the attributes changed.
public boolean isChanged(SakerPath path, long size, long modificationmillis, LinkOption... linkoptions)
Overridden from: SakerFileProvider
Checks if the given attributes of a file at the specified path are the same or not.

This method retrieves the attributes of the file at the path and compares the specified attributes.

pathThe path to the file.
sizeThe expected size of the file.
modificationmillisThe expected modification time of the file.
linkoptionsThe link options to use.
true if failed to retrieve the attributes, or the attributes changed.
public void moveFile(Path source, Path target, CopyOption... copyoptions) throws IOException
Documentation included from: SakerFileProvider
Moves a file from on location to another.
sourceThe file to move.
targetThe path to move the file to.
copyoptionsThe copy options to use.
IOExceptionIn case of I/O error.
public void moveFile(SakerPath source, SakerPath target, CopyOption... copyoptions) throws IOException
Overridden from: SakerFileProvider
Moves a file from on location to another.
sourceThe file to move.
targetThe path to move the file to.
copyoptionsThe copy options to use.
IOExceptionIn case of I/O error.
public ByteSource openInput(Path path, OpenOption... openoptions) throws IOException
Documentation included from: SakerFileProvider
Opens an input stream to the file at the specified path.

The OpenOption argument must contain elements which are enumerations.

pathThe path to the file.
openoptionsThe opening options for the input.
An opened stream.
IOExceptionIn case of I/O error.
public ByteSource openInput(SakerPath path, OpenOption... openoptions) throws IOException
Overridden from: SakerFileProvider
Opens an input stream to the file at the specified path.

The OpenOption argument must contain elements which are enumerations.

pathThe path to the file.
openoptionsThe opening options for the input.
An opened stream.
IOExceptionIn case of I/O error.
public InputStream openInputStream(Path path, OpenOption... openoptions) throws IOException
Documentation included from: SakerFileProvider
Opens an input stream to the file at the specified path.

The OpenOption argument must contain elements which are enumerations.

pathThe path to the file.
openoptionsThe opening options for the input.
An opened stream.
IOExceptionIn case of I/O error.
public ByteSink openOutput(Path path, OpenOption... openoptions) throws IOException
Documentation included from: SakerFileProvider
Opens an output stream to the file at the specified path.

The caller must close the returned stream to properly persist the written bytes to the stream. If the caller doesn't close the stream, data corruption might occur.

The OpenOption argument must contain elements which are enumerations.

pathThe path to the file.
openoptionsThe opening options for the output.
An opened output stream.
IOExceptionIn case of I/O error.
public ByteSink openOutput(SakerPath path, OpenOption... openoptions) throws IOException
Overridden from: SakerFileProvider
Opens an output stream to the file at the specified path.

The caller must close the returned stream to properly persist the written bytes to the stream. If the caller doesn't close the stream, data corruption might occur.

The OpenOption argument must contain elements which are enumerations.

pathThe path to the file.
openoptionsThe opening options for the output.
An opened output stream.
IOExceptionIn case of I/O error.
public OutputStream openOutputStream(Path path, OpenOption... openoptions) throws IOException
Documentation included from: SakerFileProvider
Opens an output stream to the file at the specified path.

The caller must close the returned stream to properly persist the written bytes to the stream. If the caller doesn't close the stream, data corruption might occur.

The OpenOption argument must contain elements which are enumerations.

pathThe path to the file.
openoptionsThe opening options for the output.
An opened output stream.
IOExceptionIn case of I/O error.
public OutputStream openOutputStream(SakerPath path, OpenOption... openoptions) throws IOException
Documentation included from: SakerFileProvider
Opens an output stream to the file at the specified path.

The caller must close the returned stream to properly persist the written bytes to the stream. If the caller doesn't close the stream, data corruption might occur.

The OpenOption argument must contain elements which are enumerations.

pathThe path to the file.
openoptionsThe opening options for the output.
An opened output stream.
IOExceptionIn case of I/O error.
public void removeFileEventListeners(Iterable<extends ListenerToken> listeners)
Overridden from: SakerFileProvider
Removes the file listeners in a bulk operation.

To remove a single file listener call FileEventListener.ListenerToken.removeListener().

The file listeners might still receive some events after this call, as the events can occur out of order. Listeners should handle that scenario gracefully.

The method will silently ignore any null elements in the argument.

listenersThe file listeners to remove.
Validation method for ensuring that the argument path is absolute and associated with the local file system.
pathThe path to validate-
The parameter path.
InvalidPathFormatExceptionIf the path is not absolute, or not associated with the default file system.
NullPointerExceptionIf the path is null.
public void setLastModifiedMillis(Path path, long millis) throws IOException
Documentation included from: SakerFileProvider
Sets the last modified time of the file at the given path.

The milliseconds are converted using FileTime.fromMillis(long).

pathThe file path.
millisThe modification time in milliseconds.
IOExceptionIn case of I/O error.
public void setLastModifiedMillis(SakerPath path, long millis) throws IOException
Overridden from: SakerFileProvider
Sets the last modified time of the file at the given path.

The milliseconds are converted using FileTime.fromMillis(long).

pathThe file path.
millisThe modification time in milliseconds.
IOExceptionIn case of I/O error.
public void setLastModifiedTime(Path path, FileTime time) throws IOException
Documentation included from: SakerFileProvider
Sets the last modified time of the file at the given path.

The milliseconds are converted using FileTime.fromMillis(long).

pathThe file path.
timeThe modification time in milliseconds.
IOExceptionIn case of I/O error.
Converts the argument absolute path to a local Path for the local file system.
pathThe path to convert.
The localized path.
InvalidPathExceptionIf the path is not valid on the local filesystem.
InvalidPathFormatExceptionIf the argument is not an absolute path.
public String toString()
Overridden from: Object
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 
a string representation of the object.
public long writeTo(Path path, ByteSink out, OpenOption... openoptions) throws IOException
Documentation included from: SakerFileProvider
Writes the contents of the file at the given path to the specified output stream.
pathThe path to the file.
outThe output to write the file contents to.
openoptionsThe opening options for the input.
The amount of bytes written to the output stream.
IOExceptionIn case of I/O error.
public long writeTo(SakerPath path, ByteSink out, OpenOption... openoptions) throws IOException
Overridden from: SakerFileProvider
Writes the contents of the file at the given path to the specified output stream.
pathThe path to the file.
outThe output to write the file contents to.
openoptionsThe opening options for the input.
The amount of bytes written to the output stream.
IOExceptionIn case of I/O error.
public long writeToFile(InputStream is, Path path, OpenOption... openoptions) throws IOException
Documentation included from: SakerFileProvider
Writes the contents from the given input stream to the specified output file path.
isThe input to get the bytes from.
pathThe output file path.
openoptionsThe opening options for the output.
The amount of bytes written to the file.
IOExceptionIn case of I/O error.
public long writeToStream(Path path, OutputStream os, OpenOption... openoptions) throws IOException
Documentation included from: SakerFileProvider
Writes the contents of the file at the given path to the specified output stream.
pathThe path to the file.
osThe output to write the file contents to.
openoptionsThe opening options for the input.
The amount of bytes written to the output stream.
IOExceptionIn case of I/O error.