FileSystem

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.

package

Default

Methods

__construct

__construct() 

Change the permissions on the file represented by <code>path</code> to <code>perms</code>, asynchronously.

chmod( $arg0,  $arg1,  $arg2) : $this

The permission String takes the form rwxr-x--- as specified here.

Arguments

$arg0

string

$arg1

string

$arg2

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem #chmod(String, String, Handler)

chmodBlocking( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

string

Response

$this

Change the permissions on the file represented by <code>path</code> to <code>perms</code>, asynchronously.<p> The permission String takes the form rwxr-x--- as specified in {<a href="http://download.oracle.com/javase/7/docs/api/java/nio/file/attribute/PosixFilePermissions.html">here</a>}.

chmodRecursive( $arg0,  $arg1,  $arg2,  $arg3) : $this

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.

Arguments

$arg0

string

$arg1

string

$arg2

string

$arg3

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::chmodRecursive

chmodRecursiveBlocking( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

string

$arg2

string

Response

$this

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

chown( $arg0,  $arg1,  $arg2,  $arg3) : $this

Arguments

$arg0

string

$arg1

string

$arg2

string

$arg3

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of

chownBlocking( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

string

$arg2

string

Response

$this

Copy a file from the path <code>from</code> to path <code>to</code>, asynchronously.

copy( $arg0,  $arg1,  $arg2,  $arg3 = null) : $this

The copy will fail if the destination already exists. param $from [string] the path to copy from param $to [string] the path to copy to param $handler [callable] the handler that will be called on completion copy($from, $to, $handler) Copy a file from the path from to path to, asynchronously. param $from [string] the path to copy from param $to [string] the path to copy to param $options [CopyOptions | array] options describing how the file should be copied param $handler [callable] the handler that will be called on completion copy($from, $to, $options, $handler)

Arguments

$arg0

string

$arg1

string

$arg2

callable | array | CopyOptions

$arg3

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::copy

copyBlocking( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

string

Response

$this

Copy a file from the path <code>from</code> to path <code>to</code>, asynchronously.

copyRecursive( $arg0,  $arg1,  $arg2,  $arg3) : $this

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.

Arguments

$arg0

string

$arg1

string

$arg2

boolean

$arg3

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::copyRecursive

copyRecursiveBlocking( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

string

$arg2

boolean

Response

$this

Creates an empty file with the specified <code>path</code>, asynchronously.

createFile( $arg0,  $arg1,  $arg2 = null) : $this

param $path [string] path to the file param $handler [callable] the handler that will be called on completion createFile($path, $handler)

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

param $path [string] path to the file param $perms [string] the permissions string param $handler [callable] the handler that will be called on completion createFile($path, $perms, $handler)

Arguments

$arg0

string

$arg1

callable | string

$arg2

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createFile

createFileBlocking( $arg0,  $arg1 = null) : $this

param $path [string] createFileBlocking($path)

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createFile

param $path [string] param $perms [string] createFileBlocking($path, $perms)

Arguments

$arg0

string

$arg1

string

Response

$this

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

createTempDirectory( $arg0,  $arg1,  $arg2 = null,  $arg3 = null) : $this

As with the File.createTempFile methods, this method is only part of a temporary-file facility.A \java.lang.Runtime, or the \java.io.File mechanism may be used to delete the directory automatically.

param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $handler [callable] the handler that will be called on completion createTempDirectory($prefix, $handler)

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 perms.

The permission String takes the form rwxr-x--- as specified in here.

As with the File.createTempFile methods, this method is only part of a temporary-file facility.A \java.lang.Runtime, or the \java.io.File mechanism may be used to delete the directory automatically.

param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $perms [string] the permissions string param $handler [callable] the handler that will be called on completion createTempDirectory($prefix, $perms, $handler)

Creates a new directory in the directory provided by the path path, using the given prefix to generate its name, 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.

As with the File.createTempFile methods, this method is only part of a temporary-file facility.A \java.lang.Runtime, or the \java.io.File mechanism may be used to delete the directory automatically.

param $dir [string] the path to directory in which to create the directory param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $perms [string] the permissions string param $handler [callable] the handler that will be called on completion createTempDirectory($dir, $prefix, $perms, $handler)

Arguments

$arg0

string

$arg1

callable | string

$arg2

callable | string

$arg3

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createTempDirectory

createTempDirectoryBlocking( $arg0,  $arg1 = null,  $arg2 = null) : string

param $prefix [string] createTempDirectoryBlocking($prefix)

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createTempDirectory

param $prefix [string] param $perms [string] createTempDirectoryBlocking($prefix, $perms)

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createTempDirectory

param $dir [string] param $prefix [string] param $perms [string] createTempDirectoryBlocking($dir, $prefix, $perms)

Arguments

$arg0

string

$arg1

string

$arg2

string

Response

string

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

createTempFile( $arg0,  $arg1,  $arg2,  $arg3 = null,  $arg4 = null) : $this

As with the File.createTempFile methods, this method is only part of a temporary-file facility.A \java.lang.Runtime, or the \java.io.File mechanism may be used to delete the directory automatically.

param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $suffix [string] 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 [callable] the handler that will be called on completion createTempFile($prefix, $suffix, $handler)

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

As with the File.createTempFile methods, this method is only part of a temporary-file facility.A \java.lang.Runtime, or the \java.io.File mechanism may be used to delete the directory automatically.

param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $suffix [string] 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 [string] param $handler [callable] the handler that will be called on completion createTempFile($prefix, $suffix, $perms, $handler)

Creates a new file in the directory provided by the path dir, using the given prefix and suffix to generate its name, 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.

As with the File.createTempFile methods, this method is only part of a temporary-file facility.A \java.lang.Runtime, or the \java.io.File mechanism may be used to delete the directory automatically.

param $dir [string] the path to directory in which to create the directory param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $suffix [string] 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 [string] the permissions string param $handler [callable] the handler that will be called on completion createTempFile($dir, $prefix, $suffix, $perms, $handler)

Arguments

$arg0

string

$arg1

string

$arg2

callable | string

$arg3

callable | string

$arg4

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createTempFile

createTempFileBlocking( $arg0,  $arg1,  $arg2 = null,  $arg3 = null) : string

param $prefix [string] param $suffix [string] createTempFileBlocking($prefix, $suffix)

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createTempFile

param $prefix [string] param $suffix [string] param $perms [string] createTempFileBlocking($prefix, $suffix, $perms)

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createTempFile

param $dir [string] param $prefix [string] param $suffix [string] param $perms [string] createTempFileBlocking($dir, $prefix, $suffix, $perms)

Arguments

$arg0

string

$arg1

string

$arg2

string

$arg3

string

Response

string

Deletes the file represented by the specified <code>path</code>, asynchronously.

delete( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::delete

deleteBlocking( $arg0) : $this

Arguments

$arg0

string

Response

$this

Deletes the file represented by the specified <code>path</code>, asynchronously.

deleteRecursive( $arg0,  $arg1,  $arg2) : $this

If the path represents a directory and recursive = true then the directory and its contents will be deleted recursively.

Arguments

$arg0

string

$arg1

boolean

$arg2

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::deleteRecursive

deleteRecursiveBlocking( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

boolean

Response

$this

Determines whether the file as specified by the path <code>path</code> exists, asynchronously.

exists( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::exists

existsBlocking( $arg0) : boolean

Arguments

$arg0

string

Response

boolean

Returns properties of the file-system being used by the specified <code>path</code>, asynchronously.

fsProps( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::fsProps

fsPropsBlocking( $arg0) : \io\vertx\jphp\core\file\FileSystemProps

Arguments

$arg0

string

Response

\io\vertx\jphp\core\file\FileSystemProps

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::link

linkBlocking( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

string

Response

$this

Obtain properties for the link represented by <code>path</code>, asynchronously.

lprops( $arg0,  $arg1) : $this

The link will not be followed.

Arguments

$arg0

string

$arg1

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::lprops

lpropsBlocking( $arg0) : \io\vertx\jphp\core\file\FileProps

Arguments

$arg0

string

Response

\io\vertx\jphp\core\file\FileProps

Create the directory represented by <code>path</code>, asynchronously.

mkdir( $arg0,  $arg1,  $arg2 = null) : $this

The operation will fail if the directory already exists. param $path [string] path to the file param $handler [callable] the handler that will be called on completion mkdir($path, $handler) Create the directory represented by path, 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. param $path [string] path to the file param $perms [string] the permissions string param $handler [callable] the handler that will be called on completion mkdir($path, $perms, $handler)

Arguments

$arg0

string

$arg1

callable | string

$arg2

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::mkdir

mkdirBlocking( $arg0,  $arg1 = null) : $this

param $path [string] mkdirBlocking($path)

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::mkdir

param $path [string] param $perms [string] mkdirBlocking($path, $perms)

Arguments

$arg0

string

$arg1

string

Response

$this

Create the directory represented by <code>path</code> and any non existent parents, asynchronously.

mkdirs( $arg0,  $arg1,  $arg2 = null) : $this

The operation will fail if the directory already exists. param $path [string] path to the file param $handler [callable] the handler that will be called on completion mkdirs($path, $handler) Create the directory represented by path and any non existent parents, 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.

param $path [string] path to the file param $perms [string] the permissions string param $handler [callable] the handler that will be called on completion mkdirs($path, $perms, $handler)

Arguments

$arg0

string

$arg1

callable | string

$arg2

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::mkdirs

mkdirsBlocking( $arg0,  $arg1 = null) : $this

param $path [string] mkdirsBlocking($path)

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::mkdirs

param $path [string] param $perms [string] mkdirsBlocking($path, $perms)

Arguments

$arg0

string

$arg1

string

Response

$this

Move a file from the path <code>from</code> to path <code>to</code>, asynchronously.

move( $arg0,  $arg1,  $arg2,  $arg3 = null) : $this

The move will fail if the destination already exists. param $from [string] the path to copy from param $to [string] the path to copy to param $handler [callable] the handler that will be called on completion move($from, $to, $handler) Move a file from the path from to path to, asynchronously. param $from [string] the path to copy from param $to [string] the path to copy to param $options [CopyOptions | array] options describing how the file should be copied param $handler [callable] the handler that will be called on completion move($from, $to, $options, $handler)

Arguments

$arg0

string

$arg1

string

$arg2

callable | array | CopyOptions

$arg3

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::move

moveBlocking( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

string

Response

$this

Open the file represented by <code>path</code>, asynchronously.

open( $arg0,  $arg1,  $arg2) : $this

The file is opened for both reading and writing. If the file does not already exist it will be created.

Arguments

$arg0

string

$arg1

OpenOptions | array

$arg2

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::open

openBlocking( $arg0,  $arg1) : \io\vertx\jphp\core\file\AsyncFile

Arguments

$arg0

string

$arg1

OpenOptions | array

Response

\io\vertx\jphp\core\file\AsyncFile

Obtain properties for the file represented by <code>path</code>, asynchronously.

props( $arg0,  $arg1) : $this

If the file is a link, the link will be followed.

Arguments

$arg0

string

$arg1

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::props

propsBlocking( $arg0) : \io\vertx\jphp\core\file\FileProps

Arguments

$arg0

string

Response

\io\vertx\jphp\core\file\FileProps

Read the contents of the directory specified by <code>path</code>, asynchronously.

readDir( $arg0,  $arg1,  $arg2 = null) : $this

The result is an array of String representing the paths of the files inside the directory. param $path [string] path to the file param $handler [callable] the handler that will be called on completion readDir($path, $handler) Read the contents of the directory specified by path, 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. param $path [string] path to the directory param $filter [string] the filter expression param $handler [callable] the handler that will be called on completion readDir($path, $filter, $handler)

Arguments

$arg0

string

$arg1

callable | string

$arg2

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::readDir

readDirBlocking( $arg0,  $arg1 = null) : array

param $path [string] readDirBlocking($path)

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::readDir

param $path [string] param $filter [string] readDirBlocking($path, $filter)

Arguments

$arg0

string

$arg1

string

Response

array

Reads the entire file as represented by the path <code>path</code> as a , asynchronously.

readFile( $arg0,  $arg1) : $this

Do not use this method to read very large files or you risk running out of available RAM.

Arguments

$arg0

string

$arg1

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::readFile

readFileBlocking( $arg0) : \io\vertx\jphp\core\buffer\Buffer

Arguments

$arg0

string

Response

\io\vertx\jphp\core\buffer\Buffer

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::readSymlink

readSymlinkBlocking( $arg0) : string

Arguments

$arg0

string

Response

string

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::link

symlinkBlocking( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

string

Response

$this

Truncate the file represented by <code>path</code> to length <code>len</code> in bytes, asynchronously.

truncate( $arg0,  $arg1,  $arg2) : $this

The operation will fail if the file does not exist or len is less than zero.

Arguments

$arg0

string

$arg1

integer

$arg2

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::truncate

truncateBlocking( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

integer

Response

$this

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::unlink

unlinkBlocking( $arg0) : $this

Arguments

$arg0

string

Response

$this

Creates the file, and writes the specified <code>Buffer data</code> to the file represented by the path <code>path</code>, asynchronously.

writeFile( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

Buffer

$arg2

callable

Response

$this

a reference to this, so the API can be used fluently

Blocking version of @see \io\vertx\jphp\core\file\FileSystem::writeFile

writeFileBlocking( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

Buffer

Response

$this