io.vertx.core.file.FileSystem Maven / Gradle / Ivy
/*
* Copyright (c) 2011-2019 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/
package io.vertx.core.file;
import io.vertx.codegen.annotations.Fluent;
import io.vertx.codegen.annotations.Nullable;
import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.buffer.Buffer;
import java.util.List;
/**
* Contains a broad set of operations for manipulating files on the file system.
*
* A (potential) blocking and non blocking version of each operation is provided.
*
* The non blocking versions take a handler which is called when the operation completes or an error occurs.
*
* The blocking versions are named {@code xxxBlocking} and return the results, or throw exceptions directly.
* In many cases, depending on the operating system and file system some of the potentially blocking operations
* can return quickly, which is why we provide them, but it's highly recommended that you test how long they take to
* return in your particular application before using them on an event loop.
*
* Please consult the documentation for more information on file system support.
*
*
* @author Tim Fox
*/
@VertxGen
public interface FileSystem {
/**
* Copy a file from the path {@code from} to path {@code to}, asynchronously.
*
* The copy will fail if the destination already exists.
*
* @param from the path to copy from
* @param to the path to copy to
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem copy(String from, String to, Handler> handler);
/**
* Like {@link #copy(String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future copy(String from, String to);
/**
* Copy a file from the path {@code from} to path {@code to}, asynchronously.
*
* @param from the path to copy from
* @param to the path to copy to
* @param options options describing how the file should be copied
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem copy(String from, String to, CopyOptions options, Handler> handler);
/**
* Like {@link #copy(String, String, CopyOptions, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future copy(String from, String to, CopyOptions options);
/**
* Blocking version of {@link #copy(String, String, Handler)}
*/
@Fluent
FileSystem copyBlocking(String from, String to) ;
/**
* Copy a file from the path {@code from} to path {@code to}, asynchronously.
*
* If {@code recursive} is {@code true} and {@code from} represents a directory, then the directory and its contents
* will be copied recursively to the destination {@code to}.
*
* The copy will fail if the destination if the destination already exists.
*
* @param from the path to copy from
* @param to the path to copy to
* @param recursive
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem copyRecursive(String from, String to, boolean recursive, Handler> handler);
/**
* Like {@link #copyRecursive(String, String, boolean, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future copyRecursive(String from, String to, boolean recursive);
/**
* Blocking version of {@link #copyRecursive(String, String, boolean, Handler)}
*/
@Fluent
FileSystem copyRecursiveBlocking(String from, String to, boolean recursive) ;
/**
* Move a file from the path {@code from} to path {@code to}, asynchronously.
*
* The move will fail if the destination already exists.
*
* @param from the path to copy from
* @param to the path to copy to
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem move(String from, String to, Handler> handler);
/**
* Like {@link #move(String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future move(String from, String to);
/**
* Move a file from the path {@code from} to path {@code to}, asynchronously.
*
* @param from the path to copy from
* @param to the path to copy to
* @param options options describing how the file should be copied
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem move(String from, String to, CopyOptions options, Handler> handler);
/**
* Like {@link #move(String, String, CopyOptions, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future move(String from, String to, CopyOptions options);
/**
* Blocking version of {@link #move(String, String, Handler)}
*/
@Fluent
FileSystem moveBlocking(String from, String to) ;
/**
* Truncate the file represented by {@code path} to length {@code len} in bytes, asynchronously.
*
* The operation will fail if the file does not exist or {@code len} is less than {@code zero}.
*
* @param path the path to the file
* @param len the length to truncate it to
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem truncate(String path, long len, Handler> handler);
/**
* Like {@link #truncate(String, long, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future truncate(String path, long len);
/**
* Blocking version of {@link #truncate(String, long, Handler)}
*/
@Fluent
FileSystem truncateBlocking(String path, long len) ;
/**
* Change the permissions on the file represented by {@code path} to {@code perms}, asynchronously.
*
* The permission String takes the form rwxr-x--- as
* specified here.
*
* @param path the path to the file
* @param perms the permissions string
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem chmod(String path, String perms, Handler> handler);
/**
* Like {@link #chmod(String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future chmod(String path, String perms);
/**
* Blocking version of {@link #chmod(String, String, Handler) }
*/
@Fluent
FileSystem chmodBlocking(String path, String perms) ;
/**
* Change the permissions on the file represented by {@code path} to {@code perms}, asynchronously.
* The permission String takes the form rwxr-x--- as
* specified in {here}.
*
* If the file is directory then all contents will also have their permissions changed recursively. Any directory permissions will
* be set to {@code dirPerms}, whilst any normal file permissions will be set to {@code perms}.
*
* @param path the path to the file
* @param perms the permissions string
* @param dirPerms the directory permissions
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem chmodRecursive(String path, String perms, String dirPerms, Handler> handler);
/**
* Like {@link #chmodRecursive(String, String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future chmodRecursive(String path, String perms, String dirPerms);
/**
* Blocking version of {@link #chmodRecursive(String, String, String, Handler)}
*/
@Fluent
FileSystem chmodRecursiveBlocking(String path, String perms, String dirPerms) ;
/**
* Change the ownership on the file represented by {@code path} to {@code user} and {code group}, asynchronously.
*
* @param path the path to the file
* @param user the user name, {@code null} will not change the user name
* @param group the user group, {@code null} will not change the user group name
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem chown(String path, @Nullable String user, @Nullable String group, Handler> handler);
/**
* Like {@link #chown(String, String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future chown(String path, @Nullable String user, @Nullable String group);
/**
* Blocking version of {@link #chown(String, String, String, Handler)}
*
*/
@Fluent
FileSystem chownBlocking(String path, @Nullable String user, @Nullable String group) ;
/**
* Obtain properties for the file represented by {@code path}, asynchronously.
*
* If the file is a link, the link will be followed.
*
* @param path the path to the file
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem props(String path, Handler> handler);
/**
* Like {@link #props(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future props(String path);
/**
* Blocking version of {@link #props(String, Handler)}
*/
FileProps propsBlocking(String path) ;
/**
* Obtain properties for the link represented by {@code path}, asynchronously.
*
* The link will not be followed.
*
* @param path the path to the file
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem lprops(String path, Handler> handler);
/**
* Like {@link #lprops(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future lprops(String path);
/**
* Blocking version of {@link #lprops(String, Handler)}
*/
FileProps lpropsBlocking(String path) ;
/**
* Create a hard link on the file system from {@code link} to {@code existing}, asynchronously.
*
* @param link the link
* @param existing the link destination
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem link(String link, String existing, Handler> handler);
/**
* Like {@link #link(String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future link(String link, String existing);
/**
* Blocking version of {@link #link(String, String, Handler)}
*/
@Fluent
FileSystem linkBlocking(String link, String existing) ;
/**
* Create a symbolic link on the file system from {@code link} to {@code existing}, asynchronously.
*
* @param link the link
* @param existing the link destination
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem symlink(String link, String existing, Handler> handler);
/**
* Like {@link #symlink(String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future symlink(String link, String existing);
/**
* Blocking version of {@link #link(String, String, Handler)}
*/
@Fluent
FileSystem symlinkBlocking(String link, String existing) ;
/**
* Unlinks the link on the file system represented by the path {@code link}, asynchronously.
*
* @param link the link
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem unlink(String link, Handler> handler);
/**
* Like {@link #unlink(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future unlink(String link);
/**
* Blocking version of {@link #unlink(String, Handler)}
*/
@Fluent
FileSystem unlinkBlocking(String link) ;
/**
* Returns the path representing the file that the symbolic link specified by {@code link} points to, asynchronously.
*
* @param link the link
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem readSymlink(String link, Handler> handler);
/**
* Like {@link #readSymlink(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future readSymlink(String link);
/**
* Blocking version of {@link #readSymlink(String, Handler)}
*/
String readSymlinkBlocking(String link) ;
/**
* Deletes the file represented by the specified {@code path}, asynchronously.
*
* @param path path to the file
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem delete(String path, Handler> handler);
/**
* Like {@link #delete(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future delete(String path);
/**
* Blocking version of {@link #delete(String, Handler)}
*/
@Fluent
FileSystem deleteBlocking(String path) ;
/**
* Deletes the file represented by the specified {@code path}, asynchronously.
*
* If the path represents a directory and {@code recursive = true} then the directory and its contents will be
* deleted recursively.
*
* @param path path to the file
* @param recursive delete recursively?
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem deleteRecursive(String path, boolean recursive, Handler> handler);
/**
* Like {@link #deleteRecursive(String, boolean, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future deleteRecursive(String path, boolean recursive);
/**
* Blocking version of {@link #deleteRecursive(String, boolean, Handler)}
*/
@Fluent
FileSystem deleteRecursiveBlocking(String path, boolean recursive) ;
/**
* Create the directory represented by {@code path}, asynchronously.
*
* The operation will fail if the directory already exists.
*
* @param path path to the file
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem mkdir(String path, Handler> handler);
/**
* Like {@link #mkdir(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future mkdir(String path);
/**
* Blocking version of {@link #mkdir(String, Handler)}
*/
@Fluent
FileSystem mkdirBlocking(String path) ;
/**
* Create the directory represented by {@code path}, asynchronously.
*
* The new directory will be created with permissions as specified by {@code perms}.
*
* The permission String takes the form rwxr-x--- as specified
* in here.
*
* The operation will fail if the directory already exists.
*
* @param path path to the file
* @param perms the permissions string
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem mkdir(String path, String perms, Handler> handler);
/**
* Like {@link #mkdir(String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future mkdir(String path, String perms);
/**
* Blocking version of {@link #mkdir(String, String, Handler)}
*/
@Fluent
FileSystem mkdirBlocking(String path, String perms) ;
/**
* Create the directory represented by {@code path} and any non existent parents, asynchronously.
*
* The operation will fail if the {@code path} already exists but is not a directory.
*
* @param path path to the file
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem mkdirs(String path, Handler> handler);
/**
* Like {@link #mkdirs(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future mkdirs(String path);
/**
* Blocking version of {@link #mkdirs(String, Handler)}
*/
@Fluent
FileSystem mkdirsBlocking(String path) ;
/**
* Create the directory represented by {@code path} and any non existent parents, asynchronously.
*
* The new directory will be created with permissions as specified by {@code perms}.
*
* The permission String takes the form rwxr-x--- as specified
* in here.
*
* The operation will fail if the {@code path} already exists but is not a directory.
*
* @param path path to the file
* @param perms the permissions string
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem mkdirs(String path, String perms, Handler> handler);
/**
* Like {@link #mkdirs(String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future mkdirs(String path, String perms);
/**
* Blocking version of {@link #mkdirs(String, String, Handler)}
*/
@Fluent
FileSystem mkdirsBlocking(String path, String perms) ;
/**
* Read the contents of the directory specified by {@code path}, asynchronously.
*
* The result is an array of String representing the paths of the files inside the directory.
*
* @param path path to the file
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem readDir(String path, Handler>> handler);
/**
* Like {@link #readDir(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future> readDir(String path);
/**
* Blocking version of {@link #readDir(String, Handler)}
*/
List readDirBlocking(String path) ;
/**
* Read the contents of the directory specified by {@code path}, asynchronously.
*
* The parameter {@code filter} is a regular expression. If {@code filter} is specified then only the paths that
* match @{filter}will be returned.
*
* The result is an array of String representing the paths of the files inside the directory.
*
* @param path path to the directory
* @param filter the filter expression
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem readDir(String path, String filter, Handler>> handler);
/**
* Like {@link #readDir(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future> readDir(String path, String filter);
/**
* Blocking version of {@link #readDir(String, String, Handler)}
*/
List readDirBlocking(String path, String filter) ;
/**
* Reads the entire file as represented by the path {@code path} as a {@link Buffer}, asynchronously.
*
* Do not use this method to read very large files or you risk running out of available RAM.
*
* @param path path to the file
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem readFile(String path, Handler> handler);
/**
* Like {@link #readFile(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future readFile(String path);
/**
* Blocking version of {@link #readFile(String, Handler)}
*/
Buffer readFileBlocking(String path) ;
/**
* Creates the file, and writes the specified {@code Buffer data} to the file represented by the path {@code path},
* asynchronously.
*
* @param path path to the file
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem writeFile(String path, Buffer data, Handler> handler);
/**
* Like {@link #writeFile(String, Buffer, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future writeFile(String path, Buffer data);
/**
* Blocking version of {@link #writeFile(String, Buffer, Handler)}
*/
@Fluent
FileSystem writeFileBlocking(String path, Buffer data) ;
/**
* Open the file represented by {@code path}, asynchronously.
*
* The file is opened for both reading and writing. If the file does not already exist it will be created.
*
* @param path path to the file
* @param options options describing how the file should be opened
* @return a reference to this, so the API can be used fluently
*
*/
@Fluent
FileSystem open(String path, OpenOptions options, Handler> handler);
/**
* Like {@link #open(String, OpenOptions, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future open(String path, OpenOptions options);
/**
* Blocking version of {@link #open(String, io.vertx.core.file.OpenOptions, Handler)}
*/
AsyncFile openBlocking(String path, OpenOptions options);
/**
* Creates an empty file with the specified {@code path}, asynchronously.
*
* @param path path to the file
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem createFile(String path, Handler> handler);
/**
* Like {@link #createFile(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future createFile(String path);
/**
* Blocking version of {@link #createFile(String, Handler)}
*/
@Fluent
FileSystem createFileBlocking(String path) ;
/**
* Creates an empty file with the specified {@code path} and permissions {@code perms}, asynchronously.
*
* @param path path to the file
* @param perms the permissions string
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem createFile(String path, String perms, Handler> handler);
/**
* Like {@link #createFile(String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future createFile(String path, String perms);
/**
* Blocking version of {@link #createFile(String, String, Handler)}
*/
@Fluent
FileSystem createFileBlocking(String path, String perms) ;
/**
* Determines whether the file as specified by the path {@code path} exists, asynchronously.
*
* @param path path to the file
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem exists(String path, Handler> handler);
/**
* Like {@link #exists(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future exists(String path);
/**
* Blocking version of {@link #exists(String, Handler)}
*/
boolean existsBlocking(String path) ;
/**
* Returns properties of the file-system being used by the specified {@code path}, asynchronously.
*
* @param path path to anywhere on the filesystem
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem fsProps(String path, Handler> handler);
/**
* Like {@link #fsProps(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future fsProps(String path);
/**
* Blocking version of {@link #fsProps(String, Handler)}
*/
FileSystemProps fsPropsBlocking(String path) ;
/**
* Creates a new directory in the default temporary-file directory, using the given
* prefix to generate its name, asynchronously.
*
*
* As with the {@code File.createTempFile} methods, this method is only
* part of a temporary-file facility.A {@link Runtime#addShutdownHook shutdown-hook},
* or the {@link java.io.File#deleteOnExit} mechanism may be used to delete the directory automatically.
*
*
* @param prefix the prefix string to be used in generating the directory's name;
* may be {@code null}
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem createTempDirectory(String prefix, Handler> handler);
/**
* Like {@link #createTempDirectory(String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future createTempDirectory(String prefix);
/**
* Blocking version of {@link #createTempDirectory(String, Handler)}
*/
String createTempDirectoryBlocking(String prefix);
/**
* Creates a new directory in the default temporary-file directory, using the given
* prefix to generate its name, asynchronously.
*
* The new directory will be created with permissions as specified by {@code perms}.
*
* The permission String takes the form rwxr-x--- as specified
* in here.
*
*
* As with the {@code File.createTempFile} methods, this method is only
* part of a temporary-file facility.A {@link Runtime#addShutdownHook shutdown-hook},
* or the {@link java.io.File#deleteOnExit} mechanism may be used to delete the directory automatically.
*
*
* @param prefix the prefix string to be used in generating the directory's name;
* may be {@code null}
* @param perms the permissions string
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem createTempDirectory(String prefix, String perms, Handler> handler);
/**
* Like {@link #createTempDirectory(String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future createTempDirectory(String prefix, String perms);
/**
* Blocking version of {@link #createTempDirectory(String, String, Handler)}
*/
String createTempDirectoryBlocking(String prefix, String perms);
/**
* Creates a new directory in the directory provided by the path {@code path}, using the given
* prefix to generate its name, asynchronously.
*
* The new directory will be created with permissions as specified by {@code perms}.
*
* The permission String takes the form rwxr-x--- as specified
* in here.
*
*
* As with the {@code File.createTempFile} methods, this method is only
* part of a temporary-file facility.A {@link Runtime#addShutdownHook shutdown-hook},
* or the {@link java.io.File#deleteOnExit} mechanism may be used to delete the directory automatically.
*
*
* @param dir the path to directory in which to create the directory
* @param prefix the prefix string to be used in generating the directory's name;
* may be {@code null}
* @param perms the permissions string
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem createTempDirectory(String dir, String prefix, String perms, Handler> handler);
/**
* Like {@link #createTempDirectory(String, String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future createTempDirectory(String dir, String prefix, String perms);
/**
* Blocking version of {@link #createTempDirectory(String, String, String, Handler)}
*/
String createTempDirectoryBlocking(String dir, String prefix, String perms);
/**
* Creates a new file in the default temporary-file directory, using the given
* prefix and suffix to generate its name, asynchronously.
*
*
* As with the {@code File.createTempFile} methods, this method is only
* part of a temporary-file facility.A {@link Runtime#addShutdownHook shutdown-hook},
* or the {@link java.io.File#deleteOnExit} mechanism may be used to delete the directory automatically.
*
*
* @param prefix the prefix string to be used in generating the directory's name;
* may be {@code null}
* @param suffix the suffix string to be used in generating the file's name;
* may be {@code null}, in which case "{@code .tmp}" is used
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem createTempFile(String prefix, String suffix, Handler> handler);
/**
* Like {@link #createTempFile(String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future createTempFile(String prefix, String suffix);
/**
* Blocking version of {@link #createTempFile(String, String, Handler)}
*/
String createTempFileBlocking(String prefix, String suffix);
/**
* Creates a new file in the directory provided by the path {@code dir}, using the given
* prefix and suffix to generate its name, asynchronously.
*
*
* As with the {@code File.createTempFile} methods, this method is only
* part of a temporary-file facility.A {@link Runtime#addShutdownHook shutdown-hook},
* or the {@link java.io.File#deleteOnExit} mechanism may be used to delete the directory automatically.
*
*
* @param prefix the prefix string to be used in generating the directory's name;
* may be {@code null}
* @param suffix the suffix string to be used in generating the file's name;
* may be {@code null}, in which case "{@code .tmp}" is used
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem createTempFile(String prefix, String suffix, String perms, Handler> handler);
/**
* Like {@link #createTempFile(String, String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future createTempFile(String prefix, String suffix, String perms);
/**
* Blocking version of {@link #createTempFile(String, String, String, Handler)}
*/
String createTempFileBlocking(String prefix, String suffix, String perms);
/**
* Creates a new file in the directory provided by the path {@code dir}, using the given
* prefix and suffix to generate its name, asynchronously.
*
* The new directory will be created with permissions as specified by {@code perms}.
*
* The permission String takes the form rwxr-x--- as specified
* in here.
*
*
* As with the {@code File.createTempFile} methods, this method is only
* part of a temporary-file facility.A {@link Runtime#addShutdownHook shutdown-hook},
* or the {@link java.io.File#deleteOnExit} mechanism may be used to delete the directory automatically.
*
*
* @param dir the path to directory in which to create the directory
* @param prefix the prefix string to be used in generating the directory's name;
* may be {@code null}
* @param suffix the suffix string to be used in generating the file's name;
* may be {@code null}, in which case "{@code .tmp}" is used
* @param perms the permissions string
* @param handler the handler that will be called on completion
* @return a reference to this, so the API can be used fluently
*/
@Fluent
FileSystem createTempFile(String dir, String prefix, String suffix, String perms, Handler> handler);
/**
* Like {@link #createTempFile(String, String, String, String, Handler)} but returns a {@code Future} of the asynchronous result
*/
Future createTempFile(String dir, String prefix, String suffix, String perms);
/**
* Blocking version of {@link #createTempFile(String, String, String, String, Handler)}
*/
String createTempFileBlocking(String dir, String prefix, String suffix, String perms);
}