Flow PHP

VoidStream implements DestinationStream, SourceStream

Read onlyYes
FinalYes

Interfaces

DestinationStream
SourceStream

Methods

__construct()  : mixed
append()  : self
close()  : void
content()  : string
fromResource()  : self
isOpen()  : bool
iterate()  : Generator<string|int, string>
path()  : Path
read()  : string
readLines()  : Generator<string|int, string>
size()  : null|int

Methods

append()

public append(string $data) : self
Parameters
$data : string
Return values
self

content()

public content() : string
Return values
string

fromResource()

public fromResource(mixed $resource) : self
Parameters
$resource : mixed
Return values
self

isOpen()

public isOpen() : bool
Return values
bool

iterate()

public iterate([int $length = 1 ]) : Generator<string|int, string>
Parameters
$length : int = 1

number of bytes to read from the stream

Return values
Generator<string|int, string>

read()

public read(int $length, int $offset) : string
Parameters
$length : int

number of bytes to read from the stream

$offset : int

The offset where to start reading from the stream. If negative, reading will start from the end of the stream.

Return values
string

readLines()

public readLines([string $separator = " " ][, int|null $length = null ]) : Generator<string|int, string>
Parameters
$separator : string = " "

The line separator, content will be read until the first occurrence of the separator

$length : int|null = null

Number of bytes to read in one step. If the end of the stream or separator is reached before the specified number of bytes are read, the remaining bytes are returned. Otherwise we are reading until the separator is found or end of file is reached. When working with remote streams it might be a good idea to set length to few mb in orders to reduce number of network requests. When no value is provided, filesystems will use a default value, for example NativeLocalFilesystem is going to use 8192 length.

Return values
Generator<string|int, string>

size()

public size() : null|int
Return values
null|int

The size of the stream in bytes


        
On this page

Search results