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) : void
The handler will be called when the close is complete, or an error occurs.
callable
drainHandler( $arg0) : $this
callable
$this
end( $arg0, $arg1 = null) : void
param $handler [callable] end($handler)
Same as but with an handler
called when the operation completes
param $data [Buffer] param $handler [callable] end($data, $handler)
Buffer | callable
callable
endHandler( $arg0) : $this
callable
$this
exceptionHandler( $arg0) : $this
callable
$this
fetch( $arg0) : $this
integer
$this
flush( $arg0) : $this
callable
$this
getWritePos() : integer
integer
the current write position the file is at
handler( $arg0) : $this
callable
$this
pause() : $this
$this
pipe() : \io\vertx\jphp\core\file\Pipe<Buffer>
The stream will be resumed when the pipe will be wired to a WriteStream
.
\io\vertx\jphp\core\file\Pipe
a pipe
pipeTo( $arg0, $arg1) : void
Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the handler
will be
called with the result.
WriteStream
callable
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
setReadLength( $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, $arg2 = null) : void
param $data [Buffer] param $handler [callable] write($data, $handler)
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
callable | integer
callable
writeQueueFull() : boolean
boolean
true if write queue is full