Open Journal Systems
3.3.0
|
Public Member Functions | |
__construct (StreamInterface $stream, $useFileBuffer=true, $memoryBuffer=2097152) | |
__toString () | |
close () | |
detach () | |
eof () | |
getContents () | |
getMetadata ($key=null) | |
getSize () | |
isReadable () | |
isSeekable () | |
isWritable () | |
read ($length) | |
rewind () | |
seek ($offset, $whence=SEEK_SET) | |
tell () | |
write ($string) | |
Decorator to make any stream seekable.
Internally it buffers an existing StreamInterface into a php://temp resource (or memory). By default it will use 2 megabytes of memory before writing to a temporary disk file.
Due to this, very large stream can suffer performance issue (i/o slowdown).
Definition at line 15 of file BufferedStream.php.
Http\Message\Stream\BufferedStream::__construct | ( | StreamInterface | $stream, |
$useFileBuffer = true , |
|||
$memoryBuffer = 2097152 |
|||
) |
StreamInterface | $stream | Decorated stream |
bool | $useFileBuffer | Whether to use a file buffer (write to a file, if data exceed a certain size) by default, set this to false to only use memory |
int | $memoryBuffer | In conjunction with using file buffer, limit (in bytes) from which it begins to buffer the data in a file |
Definition at line 48 of file BufferedStream.php.
Http\Message\Stream\BufferedStream::__toString | ( | ) |
{Reads all data from the stream into a string, from the beginning to end.This method MUST attempt to seek to the beginning of the stream before reading data and read the stream until the end is reached.Warning: This could attempt to load a large amount of data into memory.This method MUST NOT raise an exception in order to conform with PHP's string casting operations.
Implements Psr\Http\Message\StreamInterface.
Definition at line 67 of file BufferedStream.php.
References Http\Message\Stream\BufferedStream\getContents(), and Http\Message\Stream\BufferedStream\rewind().
Http\Message\Stream\BufferedStream::close | ( | ) |
{Closes the stream and any underlying resources.
Implements Psr\Http\Message\StreamInterface.
Definition at line 83 of file BufferedStream.php.
Http\Message\Stream\BufferedStream::detach | ( | ) |
{Separates any underlying resources from the stream.After the stream has been detached, the stream is in an unusable state.
Implements Psr\Http\Message\StreamInterface.
Definition at line 96 of file BufferedStream.php.
References Http\Message\Stream\BufferedStream\getContents().
Http\Message\Stream\BufferedStream::eof | ( | ) |
{Returns true if the stream is at the end of the stream.
Implements Psr\Http\Message\StreamInterface.
Definition at line 144 of file BufferedStream.php.
Referenced by Http\Message\Stream\BufferedStream\getContents().
Http\Message\Stream\BufferedStream::getContents | ( | ) |
{Returns the remaining contents in a string
Implements Psr\Http\Message\StreamInterface.
Definition at line 242 of file BufferedStream.php.
References Http\Message\Stream\BufferedStream\eof(), and Http\Message\Stream\BufferedStream\read().
Referenced by Http\Message\Stream\BufferedStream\__toString(), and Http\Message\Stream\BufferedStream\detach().
Http\Message\Stream\BufferedStream::getMetadata | ( | $key = null | ) |
{Get stream metadata as an associative array or retrieve a specific key.The keys returned are identical to the keys returned from PHP's stream_get_meta_data() function.string $key Specific metadata to retrieve. array|mixed|null Returns an associative array if no key is provided. Returns a specific key value if a key is provided and the value is found, or null if the key is not found.}
Implements Psr\Http\Message\StreamInterface.
Definition at line 260 of file BufferedStream.php.
Http\Message\Stream\BufferedStream::getSize | ( | ) |
{Get the size of the stream if known.
Implements Psr\Http\Message\StreamInterface.
Definition at line 116 of file BufferedStream.php.
Http\Message\Stream\BufferedStream::isReadable | ( | ) |
{Returns whether or not the stream is readable.
Implements Psr\Http\Message\StreamInterface.
Definition at line 205 of file BufferedStream.php.
Http\Message\Stream\BufferedStream::isSeekable | ( | ) |
{Returns whether or not the stream is seekable.
Implements Psr\Http\Message\StreamInterface.
Definition at line 157 of file BufferedStream.php.
Http\Message\Stream\BufferedStream::isWritable | ( | ) |
{Returns whether or not the stream is writable.
Implements Psr\Http\Message\StreamInterface.
Definition at line 189 of file BufferedStream.php.
Http\Message\Stream\BufferedStream::read | ( | $length | ) |
{Read data from the stream.
int | $length | 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. |
Implements Psr\Http\Message\StreamInterface.
Definition at line 213 of file BufferedStream.php.
Referenced by Http\Message\Stream\BufferedStream\getContents().
Http\Message\Stream\BufferedStream::rewind | ( | ) |
{Seek to the beginning of the stream.If the stream is not seekable, this method will raise an exception; otherwise, it will perform a seek(0).
Implements Psr\Http\Message\StreamInterface.
Definition at line 177 of file BufferedStream.php.
Referenced by Http\Message\Stream\BufferedStream\__toString().
Http\Message\Stream\BufferedStream::seek | ( | $offset, | |
$whence = SEEK_SET |
|||
) |
Implements Psr\Http\Message\StreamInterface.
Definition at line 165 of file BufferedStream.php.
Http\Message\Stream\BufferedStream::tell | ( | ) |
{Returns the current position of the file read/write pointer
Implements Psr\Http\Message\StreamInterface.
Definition at line 132 of file BufferedStream.php.
Http\Message\Stream\BufferedStream::write | ( | $string | ) |
{Write data to the stream.
string | $string | The string that is to be written. |
Implements Psr\Http\Message\StreamInterface.
Definition at line 197 of file BufferedStream.php.