public class DefaultFileSystem extends java.lang.Object implements FileSystem
| Modifier and Type | Field and Description |
|---|---|
protected VertxInternal |
vertx |
| Constructor and Description |
|---|
DefaultFileSystem(VertxInternal vertx) |
| Modifier and Type | Method and Description |
|---|---|
FileSystem |
chmod(java.lang.String path,
java.lang.String perms,
Handler<AsyncResult<java.lang.Void>> handler)
Change the permissions on the file represented by
path to perms, asynchronously. |
FileSystem |
chmod(java.lang.String path,
java.lang.String perms,
java.lang.String dirPerms,
Handler<AsyncResult<java.lang.Void>> handler)
Change the permissions on the file represented by
path to perms, asynchronously. |
protected BlockingAction<java.lang.Void> |
chmodInternal(java.lang.String path,
java.lang.String perms,
java.lang.String dirPerms,
Handler<AsyncResult<java.lang.Void>> handler) |
FileSystem |
chmodSync(java.lang.String path,
java.lang.String perms)
Synchronous version of
FileSystem.chmod(String, String, Handler) |
FileSystem |
chmodSync(java.lang.String path,
java.lang.String perms,
java.lang.String dirPerms)
Synchronous version of
FileSystem.chmod(String, String, String, Handler) |
FileSystem |
copy(java.lang.String from,
java.lang.String to,
boolean recursive,
Handler<AsyncResult<java.lang.Void>> handler)
Copy a file from the path
from to path to, asynchronously. |
FileSystem |
copy(java.lang.String from,
java.lang.String to,
Handler<AsyncResult<java.lang.Void>> handler)
Copy a file from the path
from to path to, asynchronously. |
FileSystem |
copySync(java.lang.String from,
java.lang.String to)
Synchronous version of
FileSystem.copy(String, String, Handler) |
FileSystem |
copySync(java.lang.String from,
java.lang.String to,
boolean recursive)
Synchronous version of
FileSystem.copy(String, String, boolean, Handler) |
FileSystem |
createFile(java.lang.String path,
Handler<AsyncResult<java.lang.Void>> handler)
Creates an empty file with the specified
path, asynchronously. |
FileSystem |
createFile(java.lang.String path,
java.lang.String perms,
Handler<AsyncResult<java.lang.Void>> handler)
Creates an empty file with the specified
path and permissions perms, asynchronously. |
protected BlockingAction<java.lang.Void> |
createFileInternal(java.lang.String p,
java.lang.String perms,
Handler<AsyncResult<java.lang.Void>> handler) |
FileSystem |
createFileSync(java.lang.String path)
Synchronous version of
FileSystem.createFile(String, Handler) |
FileSystem |
createFileSync(java.lang.String path,
java.lang.String perms)
Synchronous version of
FileSystem.createFile(String, String, Handler) |
FileSystem |
delete(java.lang.String path,
boolean recursive,
Handler<AsyncResult<java.lang.Void>> handler)
Deletes the file represented by the specified
path, asynchronously. |
FileSystem |
delete(java.lang.String path,
Handler<AsyncResult<java.lang.Void>> handler)
Deletes the file represented by the specified
path, asynchronously. |
FileSystem |
deleteSync(java.lang.String path)
Synchronous version of
FileSystem.delete(String, Handler) |
FileSystem |
deleteSync(java.lang.String path,
boolean recursive)
Synchronous version of
FileSystem.delete(String, boolean, Handler) |
protected AsyncFile |
doOpen(java.lang.String path,
java.lang.String perms,
boolean read,
boolean write,
boolean createNew,
boolean flush,
DefaultContext context) |
FileSystem |
exists(java.lang.String path,
Handler<AsyncResult<java.lang.Boolean>> handler)
Determines whether the file as specified by the path
path exists, asynchronously. |
boolean |
existsSync(java.lang.String path)
Synchronous version of
FileSystem.exists(String, Handler) |
FileSystem |
fsProps(java.lang.String path,
Handler<AsyncResult<FileSystemProps>> handler)
Returns properties of the file-system being used by the specified
path, asynchronously. |
FileSystemProps |
fsPropsSync(java.lang.String path)
Synchronous version of
FileSystem.fsProps(String, Handler) |
FileSystem |
link(java.lang.String link,
java.lang.String existing,
Handler<AsyncResult<java.lang.Void>> handler)
Create a hard link on the file system from
link to existing, asynchronously. |
FileSystem |
linkSync(java.lang.String link,
java.lang.String existing)
Synchronous version of
FileSystem.link(String, String, Handler) |
FileSystem |
lprops(java.lang.String path,
Handler<AsyncResult<FileProps>> handler)
Obtain properties for the link represented by
path, asynchronously. |
FileProps |
lpropsSync(java.lang.String path)
Synchronous version of
FileSystem.lprops(String, Handler) |
FileSystem |
mkdir(java.lang.String path,
boolean createParents,
Handler<AsyncResult<java.lang.Void>> handler)
Create the directory represented by
path, asynchronously. |
FileSystem |
mkdir(java.lang.String path,
Handler<AsyncResult<java.lang.Void>> handler)
Create the directory represented by
path, asynchronously. |
FileSystem |
mkdir(java.lang.String path,
java.lang.String perms,
boolean createParents,
Handler<AsyncResult<java.lang.Void>> handler)
Create the directory represented by
path, asynchronously. |
FileSystem |
mkdir(java.lang.String path,
java.lang.String perms,
Handler<AsyncResult<java.lang.Void>> handler)
Create the directory represented by
path, asynchronously. |
protected BlockingAction<java.lang.Void> |
mkdirInternal(java.lang.String path,
java.lang.String perms,
boolean createParents,
Handler<AsyncResult<java.lang.Void>> handler) |
FileSystem |
mkdirSync(java.lang.String path)
Synchronous version of
FileSystem.mkdir(String, Handler) |
FileSystem |
mkdirSync(java.lang.String path,
boolean createParents)
Synchronous version of
FileSystem.mkdir(String, boolean, Handler) |
FileSystem |
mkdirSync(java.lang.String path,
java.lang.String perms)
Synchronous version of
FileSystem.mkdir(String, String, Handler) |
FileSystem |
mkdirSync(java.lang.String path,
java.lang.String perms,
boolean createParents)
Synchronous version of
FileSystem.mkdir(String, String, boolean, Handler) |
FileSystem |
move(java.lang.String from,
java.lang.String to,
Handler<AsyncResult<java.lang.Void>> handler)
Move a file from the path
from to path to, asynchronously. |
FileSystem |
moveSync(java.lang.String from,
java.lang.String to)
Synchronous version of
FileSystem.move(String, String, Handler) |
FileSystem |
open(java.lang.String path,
Handler<AsyncResult<AsyncFile>> handler)
Open the file represented by
path, asynchronously. |
FileSystem |
open(java.lang.String path,
java.lang.String perms,
boolean read,
boolean write,
boolean createNew,
boolean flush,
Handler<AsyncResult<AsyncFile>> handler)
Open the file represented by
path, asynchronously. |
FileSystem |
open(java.lang.String path,
java.lang.String perms,
boolean read,
boolean write,
boolean createNew,
Handler<AsyncResult<AsyncFile>> handler)
Open the file represented by
path, asynchronously. |
FileSystem |
open(java.lang.String path,
java.lang.String perms,
boolean createNew,
Handler<AsyncResult<AsyncFile>> handler)
Open the file represented by
path, asynchronously. |
FileSystem |
open(java.lang.String path,
java.lang.String perms,
Handler<AsyncResult<AsyncFile>> handler)
Open the file represented by
path, asynchronously. |
AsyncFile |
openSync(java.lang.String path)
Synchronous version of
FileSystem.open(String, Handler) |
AsyncFile |
openSync(java.lang.String path,
java.lang.String perms)
Synchronous version of
FileSystem.open(String, String, Handler) |
AsyncFile |
openSync(java.lang.String path,
java.lang.String perms,
boolean createNew)
Synchronous version of
FileSystem.open(String, String, boolean, Handler) |
AsyncFile |
openSync(java.lang.String path,
java.lang.String perms,
boolean read,
boolean write,
boolean createNew)
Synchronous version of
FileSystem.open(String, String, boolean, boolean, boolean, Handler) |
AsyncFile |
openSync(java.lang.String path,
java.lang.String perms,
boolean read,
boolean write,
boolean createNew,
boolean flush)
Synchronous version of
FileSystem.open(String, String, boolean, boolean, boolean, boolean, Handler) |
FileSystem |
props(java.lang.String path,
Handler<AsyncResult<FileProps>> handler)
Obtain properties for the file represented by
path, asynchronously. |
FileProps |
propsSync(java.lang.String path)
Synchronous version of
FileSystem.props(String, Handler) |
FileSystem |
readDir(java.lang.String path,
Handler<AsyncResult<java.lang.String[]>> handler)
Read the contents of the directory specified by
path, asynchronously. |
FileSystem |
readDir(java.lang.String path,
java.lang.String filter,
Handler<AsyncResult<java.lang.String[]>> handler)
Read the contents of the directory specified by
path, asynchronously. |
java.lang.String[] |
readDirSync(java.lang.String path)
Synchronous version of
FileSystem.readDir(String, Handler) |
java.lang.String[] |
readDirSync(java.lang.String path,
java.lang.String filter)
Synchronous version of
FileSystem.readDir(String, String, Handler) |
FileSystem |
readFile(java.lang.String path,
Handler<AsyncResult<Buffer>> handler)
Reads the entire file as represented by the path
path as a Buffer, asynchronously. |
Buffer |
readFileSync(java.lang.String path)
Synchronous version of
FileSystem.readFile(String, Handler) |
FileSystem |
readSymlink(java.lang.String link,
Handler<AsyncResult<java.lang.String>> handler)
Returns the path representing the file that the symbolic link specified by
link points to, asynchronously. |
java.lang.String |
readSymlinkSync(java.lang.String link)
Synchronous version of
FileSystem.readSymlink(String, Handler) |
FileSystem |
symlink(java.lang.String link,
java.lang.String existing,
Handler<AsyncResult<java.lang.Void>> handler)
Create a symbolic link on the file system from
link to existing, asynchronously. |
FileSystem |
symlinkSync(java.lang.String link,
java.lang.String existing)
Synchronous version of
FileSystem.link(String, String, Handler) |
FileSystem |
truncate(java.lang.String path,
long len,
Handler<AsyncResult<java.lang.Void>> handler)
Truncate the file represented by
path to length len in bytes, asynchronously. |
FileSystem |
truncateSync(java.lang.String path,
long len)
Synchronous version of
FileSystem.truncate(String, long, Handler) |
FileSystem |
unlink(java.lang.String link,
Handler<AsyncResult<java.lang.Void>> handler)
Unlinks the link on the file system represented by the path
link, asynchronously. |
FileSystem |
unlinkSync(java.lang.String link)
Synchronous version of
FileSystem.unlink(String, Handler) |
FileSystem |
writeFile(java.lang.String path,
Buffer data,
Handler<AsyncResult<java.lang.Void>> handler)
Creates the file, and writes the specified
Buffer data to the file represented by the path path,
asynchronously. |
FileSystem |
writeFileSync(java.lang.String path,
Buffer data)
Synchronous version of
FileSystem.writeFile(String, Buffer, Handler) |
protected final VertxInternal vertx
public DefaultFileSystem(VertxInternal vertx)
public FileSystem copy(java.lang.String from, java.lang.String to, Handler<AsyncResult<java.lang.Void>> handler)
FileSystemfrom to path to, asynchronously.The copy will fail if the destination already exists.
copy in interface FileSystempublic FileSystem copySync(java.lang.String from, java.lang.String to)
FileSystemFileSystem.copy(String, String, Handler)copySync in interface FileSystempublic FileSystem copy(java.lang.String from, java.lang.String to, boolean recursive, Handler<AsyncResult<java.lang.Void>> handler)
FileSystemfrom to path to, asynchronously.
If recursive is true and from represents a directory, then the directory and its contents
will be copied recursively to the destination to.
The copy will fail if the destination if the destination already exists.
copy in interface FileSystempublic FileSystem copySync(java.lang.String from, java.lang.String to, boolean recursive)
FileSystemFileSystem.copy(String, String, boolean, Handler)copySync in interface FileSystempublic FileSystem move(java.lang.String from, java.lang.String to, Handler<AsyncResult<java.lang.Void>> handler)
FileSystemfrom to path to, asynchronously.The move will fail if the destination already exists.
move in interface FileSystempublic FileSystem moveSync(java.lang.String from, java.lang.String to)
FileSystemFileSystem.move(String, String, Handler)moveSync in interface FileSystempublic FileSystem truncate(java.lang.String path, long len, Handler<AsyncResult<java.lang.Void>> handler)
FileSystempath to length len in bytes, asynchronously.
The operation will fail if the file does not exist or len is less than zero.
truncate in interface FileSystempublic FileSystem truncateSync(java.lang.String path, long len)
FileSystemFileSystem.truncate(String, long, Handler)truncateSync in interface FileSystempublic FileSystem chmod(java.lang.String path, java.lang.String perms, Handler<AsyncResult<java.lang.Void>> handler)
FileSystempath to perms, asynchronously.
The permission String takes the form rwxr-x--- as
specified here.chmod in interface FileSystempublic FileSystem chmodSync(java.lang.String path, java.lang.String perms)
FileSystemFileSystem.chmod(String, String, Handler)chmodSync in interface FileSystempublic FileSystem chmod(java.lang.String path, java.lang.String perms, java.lang.String dirPerms, Handler<AsyncResult<java.lang.Void>> handler)
FileSystempath to 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 dirPerms, whilst any normal file permissions will be set to perms.
chmod in interface FileSystempublic FileSystem chmodSync(java.lang.String path, java.lang.String perms, java.lang.String dirPerms)
FileSystemFileSystem.chmod(String, String, String, Handler)chmodSync in interface FileSystempublic FileSystem props(java.lang.String path, Handler<AsyncResult<FileProps>> handler)
FileSystempath, asynchronously.
If the file is a link, the link will be followed.props in interface FileSystempublic FileProps propsSync(java.lang.String path)
FileSystemFileSystem.props(String, Handler)propsSync in interface FileSystempublic FileSystem lprops(java.lang.String path, Handler<AsyncResult<FileProps>> handler)
FileSystempath, asynchronously.
The link will not be followed.lprops in interface FileSystempublic FileProps lpropsSync(java.lang.String path)
FileSystemFileSystem.lprops(String, Handler)lpropsSync in interface FileSystempublic FileSystem link(java.lang.String link, java.lang.String existing, Handler<AsyncResult<java.lang.Void>> handler)
FileSystemlink to existing, asynchronously.link in interface FileSystempublic FileSystem linkSync(java.lang.String link, java.lang.String existing)
FileSystemFileSystem.link(String, String, Handler)linkSync in interface FileSystempublic FileSystem symlink(java.lang.String link, java.lang.String existing, Handler<AsyncResult<java.lang.Void>> handler)
FileSystemlink to existing, asynchronously.symlink in interface FileSystempublic FileSystem symlinkSync(java.lang.String link, java.lang.String existing)
FileSystemFileSystem.link(String, String, Handler)symlinkSync in interface FileSystempublic FileSystem unlink(java.lang.String link, Handler<AsyncResult<java.lang.Void>> handler)
FileSystemlink, asynchronously.unlink in interface FileSystempublic FileSystem unlinkSync(java.lang.String link)
FileSystemFileSystem.unlink(String, Handler)unlinkSync in interface FileSystempublic FileSystem readSymlink(java.lang.String link, Handler<AsyncResult<java.lang.String>> handler)
FileSystemlink points to, asynchronously.readSymlink in interface FileSystempublic java.lang.String readSymlinkSync(java.lang.String link)
FileSystemFileSystem.readSymlink(String, Handler)readSymlinkSync in interface FileSystempublic FileSystem delete(java.lang.String path, Handler<AsyncResult<java.lang.Void>> handler)
FileSystempath, asynchronously.delete in interface FileSystempublic FileSystem deleteSync(java.lang.String path)
FileSystemFileSystem.delete(String, Handler)deleteSync in interface FileSystempublic FileSystem delete(java.lang.String path, boolean recursive, Handler<AsyncResult<java.lang.Void>> handler)
FileSystempath, asynchronously.
If the path represents a directory and recursive = true then the directory and its contents will be
deleted recursively.
delete in interface FileSystempublic FileSystem deleteSync(java.lang.String path, boolean recursive)
FileSystemFileSystem.delete(String, boolean, Handler)deleteSync in interface FileSystempublic FileSystem mkdir(java.lang.String path, Handler<AsyncResult<java.lang.Void>> handler)
FileSystempath, asynchronously.The operation will fail if the directory already exists.
mkdir in interface FileSystempublic FileSystem mkdirSync(java.lang.String path)
FileSystemFileSystem.mkdir(String, Handler)mkdirSync in interface FileSystempublic FileSystem mkdir(java.lang.String path, boolean createParents, Handler<AsyncResult<java.lang.Void>> handler)
FileSystempath, asynchronously.
If createParents is set to true then any non-existent parent directories of the directory
will also be created.
The operation will fail if the directory already exists.
mkdir in interface FileSystempublic FileSystem mkdirSync(java.lang.String path, boolean createParents)
FileSystemFileSystem.mkdir(String, boolean, Handler)mkdirSync in interface FileSystempublic FileSystem mkdir(java.lang.String path, java.lang.String perms, Handler<AsyncResult<java.lang.Void>> handler)
FileSystempath, asynchronously.
The new directory will be created with permissions as specified by perms.
The permission String takes the form rwxr-x--- as specified
in here.
The operation will fail if the directory already exists.
mkdir in interface FileSystempublic FileSystem mkdirSync(java.lang.String path, java.lang.String perms)
FileSystemFileSystem.mkdir(String, String, Handler)mkdirSync in interface FileSystempublic FileSystem mkdir(java.lang.String path, java.lang.String perms, boolean createParents, Handler<AsyncResult<java.lang.Void>> handler)
FileSystempath, asynchronously.
The new directory will be created with permissions as specified by perms.
The permission String takes the form rwxr-x--- as specified
in here.
If createParents is set to true then any non-existent parent directories of the directory
will also be created.
The operation will fail if the directory already exists.
mkdir in interface FileSystempublic FileSystem mkdirSync(java.lang.String path, java.lang.String perms, boolean createParents)
FileSystemFileSystem.mkdir(String, String, boolean, Handler)mkdirSync in interface FileSystempublic FileSystem readDir(java.lang.String path, Handler<AsyncResult<java.lang.String[]>> handler)
FileSystempath, asynchronously.The result is an array of String representing the paths of the files inside the directory.
readDir in interface FileSystempublic java.lang.String[] readDirSync(java.lang.String path)
FileSystemFileSystem.readDir(String, Handler)readDirSync in interface FileSystempublic FileSystem readDir(java.lang.String path, java.lang.String filter, Handler<AsyncResult<java.lang.String[]>> handler)
FileSystempath, asynchronously.
The parameter filter is a regular expression. If 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.
readDir in interface FileSystempublic java.lang.String[] readDirSync(java.lang.String path,
java.lang.String filter)
FileSystemFileSystem.readDir(String, String, Handler)readDirSync in interface FileSystempublic FileSystem readFile(java.lang.String path, Handler<AsyncResult<Buffer>> handler)
FileSystempath as a Buffer, asynchronously.Do not user this method to read very large files or you risk running out of available RAM.
readFile in interface FileSystempublic Buffer readFileSync(java.lang.String path)
FileSystemFileSystem.readFile(String, Handler)readFileSync in interface FileSystempublic FileSystem writeFile(java.lang.String path, Buffer data, Handler<AsyncResult<java.lang.Void>> handler)
FileSystemBuffer data to the file represented by the path path,
asynchronously.writeFile in interface FileSystempublic FileSystem writeFileSync(java.lang.String path, Buffer data)
FileSystemFileSystem.writeFile(String, Buffer, Handler)writeFileSync in interface FileSystempublic FileSystem open(java.lang.String path, Handler<AsyncResult<AsyncFile>> handler)
FileSystempath, asynchronously.The file is opened for both reading and writing. If the file does not already exist it will be created. Write operations will not automatically flush to storage.
open in interface FileSystempublic AsyncFile openSync(java.lang.String path)
FileSystemFileSystem.open(String, Handler)openSync in interface FileSystempublic FileSystem open(java.lang.String path, java.lang.String perms, Handler<AsyncResult<AsyncFile>> handler)
FileSystempath, asynchronously.
The file is opened for both reading and writing. If the file does not already exist it will be created with the
permissions as specified by perms.
Write operations will not automatically flush to storage.
open in interface FileSystempublic AsyncFile openSync(java.lang.String path, java.lang.String perms)
FileSystemFileSystem.open(String, String, Handler)openSync in interface FileSystempublic FileSystem open(java.lang.String path, java.lang.String perms, boolean createNew, Handler<AsyncResult<AsyncFile>> handler)
FileSystempath, asynchronously.
The file is opened for both reading and writing. If the file does not already exist and
createNew is true it will be created with the permissions as specified by perms, otherwise
the operation will fail.
Write operations will not automatically flush to storage.
open in interface FileSystempublic AsyncFile openSync(java.lang.String path, java.lang.String perms, boolean createNew)
FileSystemFileSystem.open(String, String, boolean, Handler)openSync in interface FileSystempublic FileSystem open(java.lang.String path, java.lang.String perms, boolean read, boolean write, boolean createNew, Handler<AsyncResult<AsyncFile>> handler)
FileSystempath, asynchronously.
If read is true the file will be opened for reading. If write is true the file
will be opened for writing.
If the file does not already exist and
createNew is true it will be created with the permissions as specified by perms, otherwise
the operation will fail.
Write operations will not automatically flush to storage.
open in interface FileSystempublic AsyncFile openSync(java.lang.String path, java.lang.String perms, boolean read, boolean write, boolean createNew)
FileSystemFileSystem.open(String, String, boolean, boolean, boolean, Handler)openSync in interface FileSystempublic FileSystem open(java.lang.String path, java.lang.String perms, boolean read, boolean write, boolean createNew, boolean flush, Handler<AsyncResult<AsyncFile>> handler)
FileSystempath, asynchronously.
If read is true the file will be opened for reading. If write is true the file
will be opened for writing.
If the file does not already exist and
createNew is true it will be created with the permissions as specified by perms, otherwise
the operation will fail.
If flush is true then all writes will be automatically flushed through OS buffers to the underlying
storage on each write.
open in interface FileSystempublic AsyncFile openSync(java.lang.String path, java.lang.String perms, boolean read, boolean write, boolean createNew, boolean flush)
FileSystemFileSystem.open(String, String, boolean, boolean, boolean, boolean, Handler)openSync in interface FileSystempublic FileSystem createFile(java.lang.String path, Handler<AsyncResult<java.lang.Void>> handler)
FileSystempath, asynchronously.createFile in interface FileSystempublic FileSystem createFileSync(java.lang.String path)
FileSystemFileSystem.createFile(String, Handler)createFileSync in interface FileSystempublic FileSystem createFile(java.lang.String path, java.lang.String perms, Handler<AsyncResult<java.lang.Void>> handler)
FileSystempath and permissions perms, asynchronously.createFile in interface FileSystempublic FileSystem createFileSync(java.lang.String path, java.lang.String perms)
FileSystemFileSystem.createFile(String, String, Handler)createFileSync in interface FileSystempublic FileSystem exists(java.lang.String path, Handler<AsyncResult<java.lang.Boolean>> handler)
FileSystempath exists, asynchronously.exists in interface FileSystempublic boolean existsSync(java.lang.String path)
FileSystemFileSystem.exists(String, Handler)existsSync in interface FileSystempublic FileSystem fsProps(java.lang.String path, Handler<AsyncResult<FileSystemProps>> handler)
FileSystempath, asynchronously.fsProps in interface FileSystempublic FileSystemProps fsPropsSync(java.lang.String path)
FileSystemFileSystem.fsProps(String, Handler)fsPropsSync in interface FileSystemprotected BlockingAction<java.lang.Void> chmodInternal(java.lang.String path, java.lang.String perms, java.lang.String dirPerms, Handler<AsyncResult<java.lang.Void>> handler)
protected BlockingAction<java.lang.Void> mkdirInternal(java.lang.String path, java.lang.String perms, boolean createParents, Handler<AsyncResult<java.lang.Void>> handler)
protected AsyncFile doOpen(java.lang.String path, java.lang.String perms, boolean read, boolean write, boolean createNew, boolean flush, DefaultContext context)
protected BlockingAction<java.lang.Void> createFileInternal(java.lang.String p, java.lang.String perms, Handler<AsyncResult<java.lang.Void>> handler)