Represents a file on the file-system which can be read from, or written to asynchronously.
This class also implements @see \io\vertx\jphp\core\streams\ReadStream and
see |
This allows the data to be pumped to and from other streams, e.g. an @see \io\vertx\jphp\core\http\HttpClientRequest instance, using the @see \io\vertx\jphp\core\streams\Pump class |
---|---|
package |
Default |
__construct()
close( $arg0 = null) : void
close()
Close the file. The actual close happens asynchronously. The handler will be called when the close is complete, or an error occurs.
param $handler [callable] the handler close($handler)
callable
drainHandler( $arg0) : $this
callable
$this
end( $arg0 = null) : void
end()
Same as @see \io\vertx\jphp\core\file\AsyncFile::end but writes some data to the stream before ending.
param $t [Buffer] end($t)
Buffer
endHandler( $arg0) : $this
callable
$this
exceptionHandler( $arg0) : $this
callable
$this
fetch( $arg0) : $this
integer
$this
flush( $arg0 = null) : $this
If the file was opened with flush
set to true
then calling this method will have no effect.
The actual flush will happen asynchronously. flush() Same as @see \io\vertx\jphp\core\file\AsyncFile::flush but the handler will be called when the flush is complete or if an error occurs param $handler [callable] flush($handler)
callable
$this
a reference to this, so the API can be used fluently
handler( $arg0) : $this
callable
$this
pause() : $this
$this
read( $arg0, $arg1, $arg2, $arg3, $arg4) : $this
The read data will be written into the specified Buffer buffer
at position offset
.
If data is read past the end of the file then zero bytes will be read.
When multiple reads are invoked on the same file there are no guarantees as to order in which those reads actually occur.
The handler will be called when the close is complete, or if an error occurs.
Buffer
integer
integer
integer
callable
$this
a reference to this, so the API can be used fluently
resume() : $this
$this
setReadBufferSize( $arg0) : $this
integer
$this
a reference to this, so the API can be used fluently
setReadPos( $arg0) : $this
integer
$this
a reference to this, so the API can be used fluently
setWritePos( $arg0) : $this
integer
$this
a reference to this, so the API can be used fluently
setWriteQueueMaxSize( $arg0) : $this
integer
$this
write( $arg0, $arg1 = null, $arg2 = null) : $this
Write a @see \io\vertx\jphp\core\buffer\Buffer to the file at position position
in the file, asynchronously.
If position
lies outside of the current size
of the file, the file will be enlarged to encompass it.
When multiple writes are invoked on the same file there are no guarantees as to order in which those writes actually occur
The handler will be called when the write is complete, or if an error occurs. param $buffer [Buffer] the buffer to write param $position [integer] the position in the file to write it at param $handler [callable] the handler to call when the write is complete write($buffer, $position, $handler)
Buffer
integer
callable
$this
writeQueueFull() : boolean
boolean
true if write queue is full