Top Description Methods
io.vertx.core.file

public Interface FileSystem

Known Direct Implementers
io.vertx.core.file.impl.FileSystemImpl
Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.Fluent, .Nullable, .VertxGen, io.vertx.core.AsyncResult, .Future, .Handler, io.vertx.core.buffer.Buffer, 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 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

Method Summary

Modifier and TypeMethod and Description
public FileSystem

Returns:

a reference to this, so the API can be used fluently
chmod
(String
the path to the file
path
,
String
the permissions string
perms
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Change the permissions on the file represented by path to perms, asynchronously.

public Future<Void>
chmod(String path, String perms)

Like chmod(String, String, Handler) but returns a Future of the asynchronous result

public FileSystem
public FileSystem

Returns:

a reference to this, so the API can be used fluently
chmodRecursive
(String
the path to the file
path
,
String
the permissions string
perms
,
String
the directory permissions
dirPerms
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Change the permissions on the file represented by path to perms, asynchronously.

public Future<Void>
chmodRecursive(String path, String perms, String dirPerms)

Like chmodRecursive(String, String, String, Handler) but returns a Future of the asynchronous result

public FileSystem
public FileSystem

Returns:

a reference to this, so the API can be used fluently
chown
(String
the path to the file
path
,
@Nullable String
the user name, null will not change the user name
user
,
@Nullable String
the user group, null will not change the user group name
group
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Change the ownership on the file represented by path to user and {code group}, asynchronously.

public Future<Void>
chown(String path, @Nullable String user, @Nullable String group)

Like chown(String, String, String, Handler) but returns a Future of the asynchronous result

public FileSystem
public FileSystem

Returns:

a reference to this, so the API can be used fluently
copy
(String
the path to copy from
from
,
String
the path to copy to
to
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Copy a file from the path from to path to, asynchronously.

public Future<Void>
copy(String from, String to)

Like copy(String, String, Handler) but returns a Future of the asynchronous result

public FileSystem

Returns:

a reference to this, so the API can be used fluently
copy
(String
the path to copy from
from
,
String
the path to copy to
to
,
CopyOptions
options describing how the file should be copied
options
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Copy a file from the path from to path to, asynchronously.

public Future<Void>
copy(String from, String to, CopyOptions options)

Like copy(String, String, CopyOptions, Handler) but returns a Future of the asynchronous result

public FileSystem
public FileSystem

Returns:

a reference to this, so the API can be used fluently
copyRecursive
(String
the path to copy from
from
,
String
the path to copy to
to
,
boolean recursive, Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Copy a file from the path from to path to, asynchronously.

public Future<Void>
copyRecursive(String from, String to, boolean recursive)

Like copyRecursive(String, String, boolean, Handler) but returns a Future of the asynchronous result

public FileSystem
public FileSystem

Returns:

a reference to this, so the API can be used fluently
createFile
(String
path to the file
path
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Creates an empty file with the specified path, asynchronously.

public Future<Void>
createFile(String path)

Like createFile(String, Handler) but returns a Future of the asynchronous result

public FileSystem

Returns:

a reference to this, so the API can be used fluently
createFile
(String
path to the file
path
,
String
the permissions string
perms
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Creates an empty file with the specified path and permissions perms, asynchronously.

public Future<Void>
createFile(String path, String perms)

Like createFile(String, String, Handler) but returns a Future of the asynchronous result

public FileSystem
public FileSystem
public FileSystem

Returns:

a reference to this, so the API can be used fluently
createTempDirectory
(String
the prefix string to be used in generating the directory's name; may be null
prefix
,
Handler<AsyncResult<String>>
the handler that will be called on completion
handler
)

Creates a new directory in the default temporary-file directory, using the given prefix to generate its name, asynchronously.

public Future<String>
createTempDirectory(String prefix)

Like createTempDirectory(String, Handler) but returns a Future of the asynchronous result

public FileSystem

Returns:

a reference to this, so the API can be used fluently
createTempDirectory
(String
the prefix string to be used in generating the directory's name; may be null
prefix
,
String
the permissions string
perms
,
Handler<AsyncResult<String>>
the handler that will be called on completion
handler
)

Creates a new directory in the default temporary-file directory, using the given prefix to generate its name, asynchronously.

public Future<String>
createTempDirectory(String prefix, String perms)

Like createTempDirectory(String, String, Handler) but returns a Future of the asynchronous result

public FileSystem

Returns:

a reference to this, so the API can be used fluently
createTempDirectory
(String
the path to directory in which to create the directory
dir
,
String
the prefix string to be used in generating the directory's name; may be null
prefix
,
String
the permissions string
perms
,
Handler<AsyncResult<String>>
the handler that will be called on completion
handler
)

Creates a new directory in the directory provided by the path path, using the given prefix to generate its name, asynchronously.

public Future<String>
createTempDirectory(String dir, String prefix, String perms)

Like createTempDirectory(String, String, String, Handler) but returns a Future of the asynchronous result

public String
public String
public String
public FileSystem

Returns:

a reference to this, so the API can be used fluently
createTempFile
(String
the prefix string to be used in generating the directory's name; may be null
prefix
,
String
the suffix string to be used in generating the file's name; may be null, in which case ".tmp" is used
suffix
,
Handler<AsyncResult<String>>
the handler that will be called on completion
handler
)

Creates a new file in the default temporary-file directory, using the given prefix and suffix to generate its name, asynchronously.

public Future<String>
createTempFile(String prefix, String suffix)

Like createTempFile(String, String, Handler) but returns a Future of the asynchronous result

public FileSystem

Returns:

a reference to this, so the API can be used fluently
createTempFile
(String
the prefix string to be used in generating the directory's name; may be null
prefix
,
String
the suffix string to be used in generating the file's name; may be null, in which case ".tmp" is used
suffix
,
String perms, Handler<AsyncResult<String>>
the handler that will be called on completion
handler
)

Creates a new file in the directory provided by the path dir, using the given prefix and suffix to generate its name, asynchronously.

public Future<String>
createTempFile(String prefix, String suffix, String perms)

Like createTempFile(String, String, String, Handler) but returns a Future of the asynchronous result

public FileSystem

Returns:

a reference to this, so the API can be used fluently
createTempFile
(String
the path to directory in which to create the directory
dir
,
String
the prefix string to be used in generating the directory's name; may be null
prefix
,
String
the suffix string to be used in generating the file's name; may be null, in which case ".tmp" is used
suffix
,
String
the permissions string
perms
,
Handler<AsyncResult<String>>
the handler that will be called on completion
handler
)

Creates a new file in the directory provided by the path dir, using the given prefix and suffix to generate its name, asynchronously.

public Future<String>
createTempFile(String dir, String prefix, String suffix, String perms)

Like createTempFile(String, String, String, String, Handler) but returns a Future of the asynchronous result

public String
public String
public String
public FileSystem

Returns:

a reference to this, so the API can be used fluently
delete
(String
path to the file
path
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Deletes the file represented by the specified path, asynchronously.

public Future<Void>
delete(String path)

Like delete(String, Handler) but returns a Future of the asynchronous result

public FileSystem
public FileSystem

Returns:

a reference to this, so the API can be used fluently
deleteRecursive
(String
path to the file
path
,
boolean
delete recursively?
recursive
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Deletes the file represented by the specified path, asynchronously.

public Future<Void>
deleteRecursive(String path, boolean recursive)

Like deleteRecursive(String, boolean, Handler) but returns a Future of the asynchronous result

public FileSystem
deleteRecursiveBlocking(String path, boolean recursive)

Blocking version of deleteRecursive(String, boolean, Handler)

public FileSystem

Returns:

a reference to this, so the API can be used fluently
exists
(String
path to the file
path
,
Handler<AsyncResult<Boolean>>
the handler that will be called on completion
handler
)

Determines whether the file as specified by the path path exists, asynchronously.

public Future<Boolean>
exists(String path)

Like exists(String, Handler) but returns a Future of the asynchronous result

public boolean
public FileSystem

Returns:

a reference to this, so the API can be used fluently
fsProps
(String
path to anywhere on the filesystem
path
,
Handler<AsyncResult<FileSystemProps>>
the handler that will be called on completion
handler
)

Returns properties of the file-system being used by the specified path, asynchronously.

public Future<FileSystemProps>
fsProps(String path)

Like fsProps(String, Handler) but returns a Future of the asynchronous result

public FileSystemProps
public FileSystem
linkBlocking(String link, String existing)

Blocking version of link(String, String, Handler)

public FileSystem

Returns:

a reference to this, so the API can be used fluently
lprops
(String
the path to the file
path
,
Handler<AsyncResult<FileProps>>
the handler that will be called on completion
handler
)

Obtain properties for the link represented by path, asynchronously.

public Future<FileProps>
lprops(String path)

Like lprops(String, Handler) but returns a Future of the asynchronous result

public FileProps
public FileSystem

Returns:

a reference to this, so the API can be used fluently
mkdir
(String
path to the file
path
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Create the directory represented by path, asynchronously.

public Future<Void>
mkdir(String path)

Like mkdir(String, Handler) but returns a Future of the asynchronous result

public FileSystem

Returns:

a reference to this, so the API can be used fluently
mkdir
(String
path to the file
path
,
String
the permissions string
perms
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Create the directory represented by path, asynchronously.

public Future<Void>
mkdir(String path, String perms)

Like mkdir(String, String, Handler) but returns a Future of the asynchronous result

public FileSystem
mkdirBlocking(String path)

Blocking version of mkdir(String, Handler)

public FileSystem
public FileSystem

Returns:

a reference to this, so the API can be used fluently
mkdirs
(String
path to the file
path
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Create the directory represented by path and any non existent parents, asynchronously.

public Future<Void>
mkdirs(String path)

Like mkdirs(String, Handler) but returns a Future of the asynchronous result

public FileSystem

Returns:

a reference to this, so the API can be used fluently
mkdirs
(String
path to the file
path
,
String
the permissions string
perms
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Create the directory represented by path and any non existent parents, asynchronously.

public Future<Void>
mkdirs(String path, String perms)

Like mkdirs(String, String, Handler) but returns a Future of the asynchronous result

public FileSystem
public FileSystem
public FileSystem

Returns:

a reference to this, so the API can be used fluently
move
(String
the path to copy from
from
,
String
the path to copy to
to
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Move a file from the path from to path to, asynchronously.

public Future<Void>
move(String from, String to)

Like move(String, String, Handler) but returns a Future of the asynchronous result

public FileSystem

Returns:

a reference to this, so the API can be used fluently
move
(String
the path to copy from
from
,
String
the path to copy to
to
,
CopyOptions
options describing how the file should be copied
options
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Move a file from the path from to path to, asynchronously.

public Future<Void>
move(String from, String to, CopyOptions options)

Like move(String, String, CopyOptions, Handler) but returns a Future of the asynchronous result

public FileSystem
public FileSystem

Returns:

a reference to this, so the API can be used fluently
open
(String
path to the file
path
,
OpenOptions
options describing how the file should be opened
options
,
Handler<AsyncResult<AsyncFile>> handler)

Open the file represented by path, asynchronously.

public Future<AsyncFile>
open(String path, OpenOptions options)

Like open(String, OpenOptions, Handler) but returns a Future of the asynchronous result

public AsyncFile
public FileSystem

Returns:

a reference to this, so the API can be used fluently
props
(String
the path to the file
path
,
Handler<AsyncResult<FileProps>>
the handler that will be called on completion
handler
)

Obtain properties for the file represented by path, asynchronously.

public Future<FileProps>
props(String path)

Like props(String, Handler) but returns a Future of the asynchronous result

public FileProps
propsBlocking(String path)

Blocking version of props(String, Handler)

public FileSystem

Returns:

a reference to this, so the API can be used fluently
readDir
(String
path to the file
path
,
Handler<AsyncResult<List<String>>>
the handler that will be called on completion
handler
)

Read the contents of the directory specified by path, asynchronously.

public Future<List<String>>
readDir(String path)

Like readDir(String, Handler) but returns a Future of the asynchronous result

public FileSystem

Returns:

a reference to this, so the API can be used fluently
readDir
(String
path to the directory
path
,
String
the filter expression
filter
,
Handler<AsyncResult<List<String>>>
the handler that will be called on completion
handler
)

Read the contents of the directory specified by path, asynchronously.

public Future<List<String>>
readDir(String path, String filter)

Like readDir(String, Handler) but returns a Future of the asynchronous result

public List<String>
public List<String>
public FileSystem

Returns:

a reference to this, so the API can be used fluently
readFile
(String
path to the file
path
,
Handler<AsyncResult<Buffer>>
the handler that will be called on completion
handler
)

Reads the entire file as represented by the path path as a Buffer, asynchronously.

public Future<Buffer>
readFile(String path)

Like readFile(String, Handler) but returns a Future of the asynchronous result

public Buffer
readFileBlocking(String path)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Blocking version of readFile(String, Handler)

public String
public FileSystem
symlinkBlocking(String link, String existing)

Blocking version of link(String, String, Handler)

public FileSystem

Returns:

a reference to this, so the API can be used fluently
truncate
(String
the path to the file
path
,
long
the length to truncate it to
len
,
Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)

Truncate the file represented by path to length len in bytes, asynchronously.

public Future<Void>
truncate(String path, long len)

Like truncate(String, long, Handler) but returns a Future of the asynchronous result

public FileSystem
truncateBlocking(String path, long len)

Blocking version of truncate(String, long, Handler)

public FileSystem
public FileSystem

Returns:

a reference to this, so the API can be used fluently
writeFile
(String
path to the file
path
,
Buffer data, Handler<AsyncResult<Void>>
the handler that will be called on completion
handler
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Creates the file, and writes the specified Buffer data to the file represented by the path path, asynchronously.

public Future<Void>
writeFile(String path, Buffer data)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Like writeFile(String, Buffer, Handler) but returns a Future of the asynchronous result

public FileSystem
writeFileBlocking(String path, Buffer data)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Blocking version of writeFile(String, Buffer, Handler)