Amp\File\Handle interface Handle

Summary

Properties

Methods

Methods

read — public function read(int $len): Amp\Promise

Read $len bytes from the open file handle starting at $offset

Type Parameter Description Default Value
int $len No documentation. none
write — public function write(string $data): Amp\Promise

Write $data to the open file handle starting at $offset

Type Parameter Description Default Value
string $data No documentation. none
close — public function close(): Amp\Promise

Close the file handle

Applications are not required to manually close handles -- they will be unloaded automatically when the object is garbage collected.

seek — public function seek(int $position, int $whence = \SEEK_SET): void

Set the handle's internal pointer position

$whence values:

SEEK_SET - Set position equal to offset bytes. SEEK_CUR - Set position to current location plus offset. SEEK_END - Set position to end-of-file plus offset.

Type Parameter Description Default Value
int $position No documentation. none
int $whence No documentation. \SEEK_SET
tell — public function tell(): int

Return the current internal offset position of the file handle

eof — public function eof(): bool

Test for "end-of-file" on the file handle

path — public function path(): string

Retrieve the path used when opening the file handle

mode — public function mode(): string

Retrieve the mode used when opening the file handle