function DummyExternalReadOnlyWrapper::stream_read
Same name and namespace in other branches
- 10 core/modules/file/tests/file_test/src/StreamWrapper/DummyExternalReadOnlyWrapper.php \Drupal\file_test\StreamWrapper\DummyExternalReadOnlyWrapper::stream_read()
- 11.x core/modules/file/tests/file_test/src/StreamWrapper/DummyExternalReadOnlyWrapper.php \Drupal\file_test\StreamWrapper\DummyExternalReadOnlyWrapper::stream_read()
Read from stream.
This method is called in response to fread() and fgets().
Note, remember to update the read/write position of the stream (by the number of bytes that were successfully read).
Note, PhpStreamWrapperInterface::stream_eof() is called directly after calling PhpStreamWrapperInterface::stream_read() to check if EOF has been reached. If not implemented, EOF is assumed.
Warning, when reading the whole file (e.g., with file_get_contents()), PHP will call PhpStreamWrapperInterface::stream_read() followed by PhpStreamWrapperInterface::stream_eof() in a loop but as long as PhpStreamWrapperInterface::stream_read() returns a non-empty string, the return value of PhpStreamWrapperInterface::stream_eof() is ignored.
Parameters
int $count: How many bytes of data from the current position should be returned.
Return value
string|false If there are less than $count bytes available, return as many as are available. If no more data is available, return either FALSE or an empty string.
Overrides PhpStreamWrapperInterface::stream_read
File
-
core/
modules/ file/ tests/ file_test/ src/ StreamWrapper/ DummyExternalReadOnlyWrapper.php, line 110
Class
- DummyExternalReadOnlyWrapper
- Helper class for testing the stream wrapper registry.
Namespace
Drupal\file_test\StreamWrapperCode
public function stream_read($count) {
return FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.