MediaWiki REL1_34
|
A stream class which uses a string as the underlying storage. More...
Public Member Functions | |
__construct ( $contents='') | |
Construct a StringStream with the given contents. | |
__toString () | |
close () | |
copyToStream ( $stream) | |
Copy this stream to a specified stream resource. | |
detach () | |
eof () | |
getContents () | |
getMetadata ( $key=null) | |
getSize () | |
isReadable () | |
isSeekable () | |
isWritable () | |
read ( $length) | |
rewind () | |
seek ( $offset, $whence=SEEK_SET) | |
tell () | |
write ( $string) | |
Private Attributes | |
$contents = '' | |
$offset = 0 | |
A stream class which uses a string as the underlying storage.
Surprisingly, Guzzle does not appear to have one of these. BufferStream does not do what we want.
The normal use of this class should be to first write to the stream, then rewind, then read back the whole buffer with getContents().
Seeking is supported, however seeking past the end of the string does not fill with null bytes as in a real file, it throws an exception instead.
Definition at line 16 of file StringStream.php.
MediaWiki\Rest\StringStream::__construct | ( | $contents = '' | ) |
Construct a StringStream with the given contents.
The offset will start at 0, ready for reading. If appending to the given string is desired, you should first seek to the end.
string | $contents |
Definition at line 28 of file StringStream.php.
References MediaWiki\Rest\StringStream\$contents.
MediaWiki\Rest\StringStream::__toString | ( | ) |
Definition at line 36 of file StringStream.php.
References MediaWiki\Rest\StringStream\$contents.
MediaWiki\Rest\StringStream::close | ( | ) |
Definition at line 40 of file StringStream.php.
MediaWiki\Rest\StringStream::copyToStream | ( | $stream | ) |
Copy this stream to a specified stream resource.
For some streams, this can be implemented without a tight loop in PHP code.
Equivalent to reading from the object until EOF and writing the resulting data to $stream. The position will be advanced to the end.
Note that $stream is not a StreamInterface object.
resource | $stream | Destination |
Implements MediaWiki\Rest\CopyableStreamInterface.
Definition at line 32 of file StringStream.php.
References MediaWiki\Rest\StringStream\getContents().
MediaWiki\Rest\StringStream::detach | ( | ) |
Definition at line 43 of file StringStream.php.
MediaWiki\Rest\StringStream::eof | ( | ) |
Definition at line 55 of file StringStream.php.
MediaWiki\Rest\StringStream::getContents | ( | ) |
Definition at line 123 of file StringStream.php.
References MediaWiki\Rest\StringStream\$contents.
Referenced by MediaWiki\Rest\StringStream\copyToStream().
MediaWiki\Rest\StringStream::getMetadata | ( | $key = null | ) |
Definition at line 135 of file StringStream.php.
MediaWiki\Rest\StringStream::getSize | ( | ) |
Definition at line 47 of file StringStream.php.
MediaWiki\Rest\StringStream::isReadable | ( | ) |
Definition at line 107 of file StringStream.php.
MediaWiki\Rest\StringStream::isSeekable | ( | ) |
Definition at line 59 of file StringStream.php.
MediaWiki\Rest\StringStream::isWritable | ( | ) |
Definition at line 92 of file StringStream.php.
MediaWiki\Rest\StringStream::read | ( | $length | ) |
Definition at line 111 of file StringStream.php.
References MediaWiki\Rest\StringStream\$contents.
MediaWiki\Rest\StringStream::rewind | ( | ) |
Definition at line 88 of file StringStream.php.
MediaWiki\Rest\StringStream::seek | ( | $offset, | |
$whence = SEEK_SET |
|||
) |
Definition at line 63 of file StringStream.php.
References MediaWiki\Rest\StringStream\$offset.
MediaWiki\Rest\StringStream::tell | ( | ) |
Definition at line 51 of file StringStream.php.
References MediaWiki\Rest\StringStream\$offset.
MediaWiki\Rest\StringStream::write | ( | $string | ) |
Definition at line 96 of file StringStream.php.
|
private |
Definition at line 17 of file StringStream.php.
Referenced by MediaWiki\Rest\StringStream\__construct(), MediaWiki\Rest\StringStream\__toString(), MediaWiki\Rest\StringStream\getContents(), and MediaWiki\Rest\StringStream\read().
|
private |
Definition at line 18 of file StringStream.php.
Referenced by MediaWiki\Rest\StringStream\seek(), and MediaWiki\Rest\StringStream\tell().