private function doRead(string $read, int $length): string
    {
        if (null === $this->handle) {
            throw new \LogicException('Can not read from closed input stream.');
        }

        $data = @$read($this->handle, $length);
        if (false === $data) {
            $error = lastErrorMessage('unknown error');
            if (!@feof($this->handle)) {
                throw new StreamException(
                        'Can not read from input stream: ' . $error
                );
            }

            return '';
        }

        return $data;
    }
private function doRead(string $read, int $length): string
    {
        if (null === $this->handle) {
            throw new \LogicException('Can not read from closed input stream.');
        }

        $data = @$read($this->handle, $length);
        if (false === $data) {
            $error = lastErrorMessage('unknown error');
            if (!@feof($this->handle)) {
                throw new StreamException(
                        'Can not read from input stream: ' . $error
                );
            }

            return '';
        }

        return $data;
    }
private function doRead ( string $ read , int $ length ) : string { if ( null === $ this -> handle ) { throw new \ LogicException ( 'Can not read from closed input stream.' ) ; } $ data = @ $ read ( $ this -> handle , $ length ) ; if ( false === $ data ) { $ error = lastErrorMessage ( 'unknown error' ) ; if ( ! @ feof ( $ this -> handle ) ) { throw new StreamException ( 'Can not read from input stream: ' . $ error ) ; } return '' ; } return $ data ; }
do actual read

@param   string  $read    function to use for reading from handle
@param   int     $length  max amount of bytes to read
@return  string
@throws  \LogicException
@throws  \stubbles\streams\StreamException
do actual read