VoidStream implements DestinationStream, SourceStream
Interfaces
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
__construct()
public
__construct(Path $path) : mixed
Parameters
- $path : Path
append()
public
append(string $data) : self
Parameters
- $data : string
Return values
selfclose()
public
close() : void
content()
public
content() : string
Return values
stringfromResource()
public
fromResource(mixed $resource) : self
Parameters
- $resource : mixed
Return values
selfisOpen()
public
isOpen() : bool
Return values
booliterate()
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>path()
public
path() : Path
Return values
Pathread()
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
stringreadLines()
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