public class DefaultFileSystem extends java.lang.Object implements FileSystem
| Constructor and Description |
|---|
DefaultFileSystem(VertxInternal vertx) |
| Modifier and Type | Method and Description |
|---|---|
void |
chmod(java.lang.String path,
java.lang.String perms,
AsyncResultHandler<java.lang.Void> handler)
Change the permissions on the file represented by
path to perms, asynchronously. |
void |
chmod(java.lang.String path,
java.lang.String perms,
java.lang.String dirPerms,
AsyncResultHandler<java.lang.Void> handler)
Change the permissions on the file represented by
path to perms, asynchronously. |
void |
chmodSync(java.lang.String path,
java.lang.String perms)
Synchronous version of
FileSystem.chmod(String, String, AsyncResultHandler) |
void |
chmodSync(java.lang.String path,
java.lang.String perms,
java.lang.String dirPerms)
Synchronous version of
FileSystem.chmod(String, String, String, AsyncResultHandler) |
void |
copy(java.lang.String from,
java.lang.String to,
AsyncResultHandler<java.lang.Void> handler)
Copy a file from the path
from to path to, asynchronously. |
void |
copy(java.lang.String from,
java.lang.String to,
boolean recursive,
AsyncResultHandler<java.lang.Void> handler)
Copy a file from the path
from to path to, asynchronously. |
void |
copySync(java.lang.String from,
java.lang.String to)
Synchronous version of
FileSystem.copy(String, String, AsyncResultHandler) |
void |
copySync(java.lang.String from,
java.lang.String to,
boolean recursive)
Synchronous version of
FileSystem.copy(String, String, boolean, AsyncResultHandler) |
void |
createFile(java.lang.String path,
AsyncResultHandler<java.lang.Void> handler)
Creates an empty file with the specified
path, asynchronously. |
void |
createFile(java.lang.String path,
java.lang.String perms,
AsyncResultHandler<java.lang.Void> handler)
Creates an empty file with the specified
path and permissions perms, asynchronously. |
void |
createFileSync(java.lang.String path)
Synchronous version of
FileSystem.createFile(String, AsyncResultHandler) |
void |
createFileSync(java.lang.String path,
java.lang.String perms)
Synchronous version of
FileSystem.createFile(String, String, AsyncResultHandler) |
void |
delete(java.lang.String path,
AsyncResultHandler<java.lang.Void> handler)
Deletes the file represented by the specified
path, asynchronously. |
void |
delete(java.lang.String path,
boolean recursive,
AsyncResultHandler<java.lang.Void> handler)
Deletes the file represented by the specified
path, asynchronously. |
void |
deleteSync(java.lang.String path)
Synchronous version of
FileSystem.delete(String, AsyncResultHandler) |
void |
deleteSync(java.lang.String path,
boolean recursive)
Synchronous version of
FileSystem.delete(String, boolean, AsyncResultHandler) |
void |
exists(java.lang.String path,
AsyncResultHandler<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, AsyncResultHandler) |
void |
fsProps(java.lang.String path,
AsyncResultHandler<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, AsyncResultHandler) |
void |
link(java.lang.String link,
java.lang.String existing,
AsyncResultHandler<java.lang.Void> handler)
Create a hard link on the file system from
link to existing, asynchronously. |
void |
linkSync(java.lang.String link,
java.lang.String existing)
Synchronous version of
FileSystem.link(String, String, AsyncResultHandler) |
void |
lprops(java.lang.String path,
AsyncResultHandler<FileProps> handler)
Obtain properties for the link represented by
path, asynchronously. |
FileProps |
lpropsSync(java.lang.String path)
Synchronous version of
FileSystem.lprops(String, AsyncResultHandler) |
void |
mkdir(java.lang.String path,
AsyncResultHandler<java.lang.Void> handler)
Create the directory represented by
path, asynchronously. |
void |
mkdir(java.lang.String path,
boolean createParents,
AsyncResultHandler<java.lang.Void> handler)
Create the directory represented by
path, asynchronously. |
void |
mkdir(java.lang.String path,
java.lang.String perms,
AsyncResultHandler<java.lang.Void> handler)
Create the directory represented by
path, asynchronously. |
void |
mkdir(java.lang.String path,
java.lang.String perms,
boolean createParents,
AsyncResultHandler<java.lang.Void> handler)
Create the directory represented by
path, asynchronously. |
void |
mkdirSync(java.lang.String path)
Synchronous version of
FileSystem.mkdir(String, AsyncResultHandler) |
void |
mkdirSync(java.lang.String path,
boolean createParents)
Synchronous version of
FileSystem.mkdir(String, boolean, AsyncResultHandler) |
void |
mkdirSync(java.lang.String path,
java.lang.String perms)
Synchronous version of
FileSystem.mkdir(String, String, AsyncResultHandler) |
void |
mkdirSync(java.lang.String path,
java.lang.String perms,
boolean createParents)
Synchronous version of
FileSystem.mkdir(String, String, boolean, AsyncResultHandler) |
void |
move(java.lang.String from,
java.lang.String to,
AsyncResultHandler<java.lang.Void> handler)
Move a file from the path
from to path to, asynchronously. |
void |
moveSync(java.lang.String from,
java.lang.String to)
Synchronous version of
FileSystem.move(String, String, AsyncResultHandler) |
void |
open(java.lang.String path,
AsyncResultHandler<AsyncFile> handler)
Open the file represented by
path, asynchronously. |
void |
open(java.lang.String path,
java.lang.String perms,
AsyncResultHandler<AsyncFile> handler)
Open the file represented by
path, asynchronously. |
void |
open(java.lang.String path,
java.lang.String perms,
boolean createNew,
AsyncResultHandler<AsyncFile> handler)
Open the file represented by
path, asynchronously. |
void |
open(java.lang.String path,
java.lang.String perms,
boolean read,
boolean write,
boolean createNew,
AsyncResultHandler<AsyncFile> handler)
Open the file represented by
path, asynchronously. |
void |
open(java.lang.String path,
java.lang.String perms,
boolean read,
boolean write,
boolean createNew,
boolean flush,
AsyncResultHandler<AsyncFile> handler)
Open the file represented by
path, asynchronously. |
AsyncFile |
openSync(java.lang.String path)
Synchronous version of
FileSystem.open(String, AsyncResultHandler) |
AsyncFile |
openSync(java.lang.String path,
java.lang.String perms)
Synchronous version of
FileSystem.open(String, String, AsyncResultHandler) |
AsyncFile |
openSync(java.lang.String path,
java.lang.String perms,
boolean createNew)
Synchronous version of
FileSystem.open(String, String, boolean, AsyncResultHandler) |
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, AsyncResultHandler) |
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, AsyncResultHandler) |
void |
props(java.lang.String path,
AsyncResultHandler<FileProps> handler)
Obtain properties for the file represented by
path, asynchronously. |
FileProps |
propsSync(java.lang.String path)
Synchronous version of
FileSystem.props(String, AsyncResultHandler) |
void |
readDir(java.lang.String path,
AsyncResultHandler<java.lang.String[]> handler)
Read the contents of the directory specified by
path, asynchronously. |
void |
readDir(java.lang.String path,
java.lang.String filter,
AsyncResultHandler<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, AsyncResultHandler) |
java.lang.String[] |
readDirSync(java.lang.String path,
java.lang.String filter)
Synchronous version of
FileSystem.readDir(String, String, AsyncResultHandler) |
void |
readFile(java.lang.String path,
AsyncResultHandler<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, AsyncResultHandler) |
void |
readSymlink(java.lang.String link,
AsyncResultHandler<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, AsyncResultHandler) |
void |
symlink(java.lang.String link,
java.lang.String existing,
AsyncResultHandler<java.lang.Void> handler)
Create a symbolic link on the file system from
link to existing, asynchronously. |
void |
symlinkSync(java.lang.String link,
java.lang.String existing)
Synchronous version of
FileSystem.link(String, String, AsyncResultHandler) |
void |
truncate(java.lang.String path,
long len,
AsyncResultHandler<java.lang.Void> handler)
Truncate the file represented by
path to length len in bytes, asynchronously. |
void |
truncateSync(java.lang.String path,
long len)
Synchronous version of
FileSystem.truncate(String, long, AsyncResultHandler) |
void |
unlink(java.lang.String link,
AsyncResultHandler<java.lang.Void> handler)
Unlinks the link on the file system represented by the path
link, asynchronously. |
void |
unlinkSync(java.lang.String link)
Synchronous version of
FileSystem.unlink(String, AsyncResultHandler) |
void |
writeFile(java.lang.String path,
Buffer data,
AsyncResultHandler<java.lang.Void> handler)
Creates the file, and writes the specified
Buffer data to the file represented by the path path,
asynchronously. |
void |
writeFileSync(java.lang.String path,
Buffer data)
Synchronous version of
FileSystem.writeFile(String, Buffer, AsyncResultHandler) |
public DefaultFileSystem(VertxInternal vertx)
public void copy(java.lang.String from,
java.lang.String to,
AsyncResultHandler<java.lang.Void> handler)
FileSystemfrom to path to, asynchronously.The copy will fail if the destination already exists.
copy in interface FileSystempublic void copySync(java.lang.String from,
java.lang.String to)
throws java.lang.Exception
FileSystemFileSystem.copy(String, String, AsyncResultHandler)copySync in interface FileSystemjava.lang.Exceptionpublic void copy(java.lang.String from,
java.lang.String to,
boolean recursive,
AsyncResultHandler<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 void copySync(java.lang.String from,
java.lang.String to,
boolean recursive)
throws java.lang.Exception
FileSystemFileSystem.copy(String, String, boolean, AsyncResultHandler)copySync in interface FileSystemjava.lang.Exceptionpublic void move(java.lang.String from,
java.lang.String to,
AsyncResultHandler<java.lang.Void> handler)
FileSystemfrom to path to, asynchronously.The move will fail if the destination already exists.
move in interface FileSystempublic void moveSync(java.lang.String from,
java.lang.String to)
throws java.lang.Exception
FileSystemFileSystem.move(String, String, AsyncResultHandler)moveSync in interface FileSystemjava.lang.Exceptionpublic void truncate(java.lang.String path,
long len,
AsyncResultHandler<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 void truncateSync(java.lang.String path,
long len)
throws java.lang.Exception
FileSystemFileSystem.truncate(String, long, AsyncResultHandler)truncateSync in interface FileSystemjava.lang.Exceptionpublic void chmod(java.lang.String path,
java.lang.String perms,
AsyncResultHandler<java.lang.Void> handler)
FileSystempath to perms, asynchronously.
The permission String takes the form rwxr-x--- as
specified here.chmod in interface FileSystempublic void chmodSync(java.lang.String path,
java.lang.String perms)
throws java.lang.Exception
FileSystemFileSystem.chmod(String, String, AsyncResultHandler)chmodSync in interface FileSystemjava.lang.Exceptionpublic void chmod(java.lang.String path,
java.lang.String perms,
java.lang.String dirPerms,
AsyncResultHandler<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 void chmodSync(java.lang.String path,
java.lang.String perms,
java.lang.String dirPerms)
throws java.lang.Exception
FileSystemFileSystem.chmod(String, String, String, AsyncResultHandler)chmodSync in interface FileSystemjava.lang.Exceptionpublic void props(java.lang.String path,
AsyncResultHandler<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) throws java.lang.Exception
FileSystemFileSystem.props(String, AsyncResultHandler)propsSync in interface FileSystemjava.lang.Exceptionpublic void lprops(java.lang.String path,
AsyncResultHandler<FileProps> handler)
FileSystempath, asynchronously.
The link will not be followed.lprops in interface FileSystempublic FileProps lpropsSync(java.lang.String path) throws java.lang.Exception
FileSystemFileSystem.lprops(String, AsyncResultHandler)lpropsSync in interface FileSystemjava.lang.Exceptionpublic void link(java.lang.String link,
java.lang.String existing,
AsyncResultHandler<java.lang.Void> handler)
FileSystemlink to existing, asynchronously.link in interface FileSystempublic void linkSync(java.lang.String link,
java.lang.String existing)
throws java.lang.Exception
FileSystemFileSystem.link(String, String, AsyncResultHandler)linkSync in interface FileSystemjava.lang.Exceptionpublic void symlink(java.lang.String link,
java.lang.String existing,
AsyncResultHandler<java.lang.Void> handler)
FileSystemlink to existing, asynchronously.symlink in interface FileSystempublic void symlinkSync(java.lang.String link,
java.lang.String existing)
throws java.lang.Exception
FileSystemFileSystem.link(String, String, AsyncResultHandler)symlinkSync in interface FileSystemjava.lang.Exceptionpublic void unlink(java.lang.String link,
AsyncResultHandler<java.lang.Void> handler)
FileSystemlink, asynchronously.unlink in interface FileSystempublic void unlinkSync(java.lang.String link)
throws java.lang.Exception
FileSystemFileSystem.unlink(String, AsyncResultHandler)unlinkSync in interface FileSystemjava.lang.Exceptionpublic void readSymlink(java.lang.String link,
AsyncResultHandler<java.lang.String> handler)
FileSystemlink points to, asynchronously.readSymlink in interface FileSystempublic java.lang.String readSymlinkSync(java.lang.String link)
throws java.lang.Exception
FileSystemFileSystem.readSymlink(String, AsyncResultHandler)readSymlinkSync in interface FileSystemjava.lang.Exceptionpublic void delete(java.lang.String path,
AsyncResultHandler<java.lang.Void> handler)
FileSystempath, asynchronously.delete in interface FileSystempublic void deleteSync(java.lang.String path)
throws java.lang.Exception
FileSystemFileSystem.delete(String, AsyncResultHandler)deleteSync in interface FileSystemjava.lang.Exceptionpublic void delete(java.lang.String path,
boolean recursive,
AsyncResultHandler<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 void deleteSync(java.lang.String path,
boolean recursive)
throws java.lang.Exception
FileSystemFileSystem.delete(String, boolean, AsyncResultHandler)deleteSync in interface FileSystemjava.lang.Exceptionpublic void mkdir(java.lang.String path,
AsyncResultHandler<java.lang.Void> handler)
FileSystempath, asynchronously.The operation will fail if the directory already exists.
mkdir in interface FileSystempublic void mkdirSync(java.lang.String path)
throws java.lang.Exception
FileSystemFileSystem.mkdir(String, AsyncResultHandler)mkdirSync in interface FileSystemjava.lang.Exceptionpublic void mkdir(java.lang.String path,
boolean createParents,
AsyncResultHandler<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 void mkdirSync(java.lang.String path,
boolean createParents)
throws java.lang.Exception
FileSystemFileSystem.mkdir(String, boolean, AsyncResultHandler)mkdirSync in interface FileSystemjava.lang.Exceptionpublic void mkdir(java.lang.String path,
java.lang.String perms,
AsyncResultHandler<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 void mkdirSync(java.lang.String path,
java.lang.String perms)
throws java.lang.Exception
FileSystemFileSystem.mkdir(String, String, AsyncResultHandler)mkdirSync in interface FileSystemjava.lang.Exceptionpublic void mkdir(java.lang.String path,
java.lang.String perms,
boolean createParents,
AsyncResultHandler<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 void mkdirSync(java.lang.String path,
java.lang.String perms,
boolean createParents)
throws java.lang.Exception
FileSystemFileSystem.mkdir(String, String, boolean, AsyncResultHandler)mkdirSync in interface FileSystemjava.lang.Exceptionpublic void readDir(java.lang.String path,
AsyncResultHandler<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)
throws java.lang.Exception
FileSystemFileSystem.readDir(String, AsyncResultHandler)readDirSync in interface FileSystemjava.lang.Exceptionpublic void readDir(java.lang.String path,
java.lang.String filter,
AsyncResultHandler<java.lang.String[]> handler)
FileSystempath, asynchronously.
The paramater 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)
throws java.lang.Exception
FileSystemFileSystem.readDir(String, String, AsyncResultHandler)readDirSync in interface FileSystemjava.lang.Exceptionpublic void readFile(java.lang.String path,
AsyncResultHandler<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) throws java.lang.Exception
FileSystemFileSystem.readFile(String, AsyncResultHandler)readFileSync in interface FileSystemjava.lang.Exceptionpublic void writeFile(java.lang.String path,
Buffer data,
AsyncResultHandler<java.lang.Void> handler)
FileSystemBuffer data to the file represented by the path path,
asynchronously.writeFile in interface FileSystempublic void writeFileSync(java.lang.String path,
Buffer data)
throws java.lang.Exception
FileSystemFileSystem.writeFile(String, Buffer, AsyncResultHandler)writeFileSync in interface FileSystemjava.lang.Exceptionpublic void open(java.lang.String path,
AsyncResultHandler<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) throws java.lang.Exception
FileSystemFileSystem.open(String, AsyncResultHandler)openSync in interface FileSystemjava.lang.Exceptionpublic void open(java.lang.String path,
java.lang.String perms,
AsyncResultHandler<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) throws java.lang.Exception
FileSystemFileSystem.open(String, String, AsyncResultHandler)openSync in interface FileSystemjava.lang.Exceptionpublic void open(java.lang.String path,
java.lang.String perms,
boolean createNew,
AsyncResultHandler<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) throws java.lang.Exception
FileSystemFileSystem.open(String, String, boolean, AsyncResultHandler)openSync in interface FileSystemjava.lang.Exceptionpublic void open(java.lang.String path,
java.lang.String perms,
boolean read,
boolean write,
boolean createNew,
AsyncResultHandler<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) throws java.lang.Exception
FileSystemFileSystem.open(String, String, boolean, boolean, boolean, AsyncResultHandler)openSync in interface FileSystemjava.lang.Exceptionpublic void open(java.lang.String path,
java.lang.String perms,
boolean read,
boolean write,
boolean createNew,
boolean flush,
AsyncResultHandler<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) throws java.lang.Exception
FileSystemFileSystem.open(String, String, boolean, boolean, boolean, boolean, AsyncResultHandler)openSync in interface FileSystemjava.lang.Exceptionpublic void createFile(java.lang.String path,
AsyncResultHandler<java.lang.Void> handler)
FileSystempath, asynchronously.createFile in interface FileSystempublic void createFileSync(java.lang.String path)
throws java.lang.Exception
FileSystemFileSystem.createFile(String, AsyncResultHandler)createFileSync in interface FileSystemjava.lang.Exceptionpublic void createFile(java.lang.String path,
java.lang.String perms,
AsyncResultHandler<java.lang.Void> handler)
FileSystempath and permissions perms, asynchronously.createFile in interface FileSystempublic void createFileSync(java.lang.String path,
java.lang.String perms)
throws java.lang.Exception
FileSystemFileSystem.createFile(String, String, AsyncResultHandler)createFileSync in interface FileSystemjava.lang.Exceptionpublic void exists(java.lang.String path,
AsyncResultHandler<java.lang.Boolean> handler)
FileSystempath exists, asynchronously.exists in interface FileSystempublic boolean existsSync(java.lang.String path)
throws java.lang.Exception
FileSystemFileSystem.exists(String, AsyncResultHandler)existsSync in interface FileSystemjava.lang.Exceptionpublic void fsProps(java.lang.String path,
AsyncResultHandler<FileSystemProps> handler)
FileSystempath, asynchronously.fsProps in interface FileSystempublic FileSystemProps fsPropsSync(java.lang.String path) throws java.lang.Exception
FileSystemFileSystem.fsProps(String, AsyncResultHandler)fsPropsSync in interface FileSystemjava.lang.Exception