Renderer/Adapter/Stream/Wrapper.php
public function stream_read($length)
    {

        //Abstract mb_* functions
        $substr = function_exists('mb_substr') ? 'mb_substr' : 'substr';
        $strlen = function_exists('mb_strlen') ? 'mb_strlen' : 'strlen';

        //Read that stuff chunk by chunk (whatever buffersize there is)
        $result = $substr($this->data, $this->position, $length);
        $this->position += $strlen($result);

        return $result;
    }
public function stream_read($length)
    {

        //Abstract mb_* functions
        $substr = function_exists('mb_substr') ? 'mb_substr' : 'substr';
        $strlen = function_exists('mb_strlen') ? 'mb_strlen' : 'strlen';

        //Read that stuff chunk by chunk (whatever buffersize there is)
        $result = $substr($this->data, $this->position, $length);
        $this->position += $strlen($result);

        return $result;
    }
public function stream_read ( $ length ) { //Abstract mb_* functions $ substr = function_exists ( 'mb_substr' ) ? 'mb_substr' : 'substr' ; $ strlen = function_exists ( 'mb_strlen' ) ? 'mb_strlen' : 'strlen' ; //Read that stuff chunk by chunk (whatever buffersize there is) $ result = $ substr ( $ this -> data , $ this -> position , $ length ) ; $ this -> position += $ strlen ( $ result ) ; return $ result ; }
This gets called when anything tries to read from this.

(opened) stream (e.g. fread, fgets, fgetcsv, INCLUDE(!!!) etc.)

We return the fitting chunk of our PHTML and
add that length of that to our current position so that the next
call will read the next chunk, rinse and repeat

@param int $length the length of the chunk to read

@return string
This gets called when anything tries to read from this .