CachingStream
in package
implements
StreamInterface
Uses
AStreamDecoratorTrait
Interfaces, Classes, Traits and Enums
- StreamInterface
- Describes a data stream.
Table of Contents
- $remoteStream : StreamInterface
- $skipReadBytes : int
- __call() : mixed
- __construct() : mixed
- __get() : mixed
- __toString() : mixed
- close() : void
- Closes the stream and any underlying resources.
- detach() : mixed
- eof() : bool
- Returns true if the stream is at the end of the stream.
- getContents() : string
- getMetadata() : mixed
- getSize() : mixed
- Get the size of the stream if known.
- isReadable() : bool
- isSeekable() : bool
- isWritable() : bool
- read() : string
- Read data from the stream.
- rewind() : mixed
- Seek to the beginning of the stream.
- seek() : mixed
- Seek to a position in the stream.
- tell() : int
- write() : int
- Write data to the stream.
- createStream() : mixed
- cacheEntireStream() : int
Properties
$remoteStream
private
StreamInterface
$remoteStream
$skipReadBytes
private
int
$skipReadBytes
= 0
Methods
__call()
public
__call(mixed $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : mixed
- $args : array<string|int, mixed>
Return values
mixed —__construct()
public
__construct(StreamInterface $stream[, StreamInterface $target = null ]) : mixed
Parameters
- $stream : StreamInterface
- $target : StreamInterface = null
Return values
mixed —__get()
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —__toString()
public
__toString() : mixed
Return values
mixed —close()
Closes the stream and any underlying resources.
public
close() : void
Return values
void —detach()
public
detach() : mixed
Return values
mixed —eof()
Returns true if the stream is at the end of the stream.
public
eof() : bool
Return values
bool —getContents()
public
getContents() : string
Return values
string —getMetadata()
public
getMetadata([mixed $key = null ]) : mixed
Parameters
- $key : mixed = null
Return values
mixed —getSize()
Get the size of the stream if known.
public
getSize() : mixed
Return values
mixed —Returns the size in bytes if known, or null if unknown.
isReadable()
public
isReadable() : bool
Return values
bool —isSeekable()
public
isSeekable() : bool
Return values
bool —isWritable()
public
isWritable() : bool
Return values
bool —read()
Read data from the stream.
public
read(int $length) : string
Parameters
- $length : int
-
Read up to $length bytes from the object and return them. Fewer than $length bytes may be returned if underlying stream call returns fewer bytes.
Return values
string —Returns the data read from the stream, or an empty string if no bytes are available.
rewind()
Seek to the beginning of the stream.
public
rewind() : mixed
If the stream is not seekable, this method will raise an exception; otherwise, it will perform a seek(0).
Return values
mixed —seek()
Seek to a position in the stream.
public
seek(int $offset[, int $whence = SEEK_SET ]) : mixed
Parameters
- $offset : int
-
Stream offset
- $whence : int = SEEK_SET
-
Specifies how the cursor position will be calculated based on the seek offset. Valid values are identical to the built-in PHP $whence values for
fseek()
. SEEK_SET: Set position equal to offset bytes SEEK_CUR: Set position to current location plus offset SEEK_END: Set position to end-of-stream plus offset.
Return values
mixed —tell()
public
tell() : int
Return values
int —write()
Write data to the stream.
public
write(string $string) : int
Parameters
- $string : string
-
The string that is to be written.
Return values
int —Returns the number of bytes written to the stream.
createStream()
protected
createStream() : mixed
Return values
mixed —cacheEntireStream()
private
cacheEntireStream() : int