SourceStream extends Stream
Methods
- close() : void
- content() : string
- isOpen() : bool
- iterate() : Generator<string|int, string>
- path() : Path
- read() : string
- readLines() : Generator<string|int, string>
- size() : null|int
Methods
close()
public
close() : void
content()
public
content() : string
Return values
stringisOpen()
public
isOpen() : bool
Return values
booliterate()
public
iterate([int<1, max> $length = 1 ]) : Generator<string|int, string>
Parameters
- $length : int<1, max> = 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<1, max> $length, int $offset) : string
Parameters
- $length : int<1, max>
-
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 = "
" ][, null|int<1, max> $length = null ]) : Generator<string|int, string>
Parameters
- $separator : string = " "
-
The line separator, content will be read until the first occurrence of the separator
- $length : null|int<1, max> = 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