Work out if we're at the end of the file for a stream

@return  boolean

@since   1.0
@throws  \RuntimeException
348552
public function eof()
	{
		if (!$this->fh)
		{
			throw new \RuntimeException('File not open');
		}

		// Capture PHP errors
		$php_errormsg = '';
		$track_errors = ini_get('track_errors');
		ini_set('track_errors', true);

		switch ($this->processingmethod)
		{
			case 'gz':
				$res = gzeof($this->fh);
				break;

			case 'bz':
			case 'f':
			default:
				$res = feof($this->fh);
				break;
		}

		if ($php_errormsg)
		{
			throw new \RuntimeException($php_errormsg);
		}

		// Restore error tracking to what it was before
		ini_set('track_errors', $track_errors);

		// Return the result
		return $res;
	}
1077034
public function end(array $options = array())
    {
        if (null === $this->currentBundleOptions) {
            throw new \RuntimeException('end() is called without a start() call.');
        }

        $options = array_merge($this->currentBundleOptions, $options);

        $captured = ob_get_clean();

        if ($options['bypass']) {
            echo $captured;
        } else {
            $this->extractFiles($captured, $options['docroot']);
        }

        $this->currentBundleOptions = null;

        return $this;
    }
468394
public function getOffset()
    {
        $this->assertSeekable();
        $ret = ftell($this->stream);
        if (false === $ret) {
            throw new RuntimeException('Cannot get offset of stream');
        }
        
        return $ret;
    }
26742
public function close()
    {
        $this->ending = true;

        foreach ($this->pending as $deferred) {
            $deferred->reject(new RuntimeException('Shell is ending'));
        }
        $this->pending = array();
        $this->buffer = '';

        $this->stream->removeListener('data', array($this, 'handleData'));
        $this->stream->removeListener('end', array($this, 'handleEnd'));

        $this->stream->close();
    }
593767
public function tell() : int
    {
        $pos = null;
        $err = ($this->stream === null || $this->isPipe === true);

        if ($err === false) {
            $pos = ftell($this->stream);
            $err = ($pos === false);
        }

        if ($err === true) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException("Could not get the position of the pointer in stream.");
            // @codeCoverageIgnoreEnd
        }

        return $pos;
    }
1224887
public function endRecording($stream)
    {
        $parts = explode('/', $this->streamserver_config[$stream->getRtmpServer()]['rtmp_url']);
        $rtmp_app = end($parts);
        $success = $this->record(
            $this->streamserver_config[$stream->getRtmpServer()]['rtmp_control'],
            $rtmp_app,
            $stream->getUniqID(),
            false
        );
        if ($success) {
            $stream->setTechnicalStatus(Stream::STATE_ENDED);
            $this->em->persist($stream);
            $this->em->flush();

            // $event = new EndRecordingStreamEvent($stream);
            // $this->dispatcher->dispatch(
            //     OktolabMediaEvent::STREAM_END_RECORDING,
            //     $event
            // );
            return true;
        }
        return false;
    }
1071465
public function useGlobally()
    {
        if (!isset($this->handle)) {
            throw new \RuntimeException("The stream is closed");
        }
        
        if ($this->isGlobal()) {
            return $this;
        }
        
        $this->assertOutputBuffering();
        
        $output = $this->createOutputStream();
        if ($output === false) {
            throw new \RuntimeException("Failed to create temp stream");
        }
        
        $this->obClean();
        $this->rewind();
        stream_copy_to_stream($this->handle, $output);
        
        parent::close();
        $this->handle = $output;
        
        return $this;
    }
422060
public function getContents()
    {
        $this->valideAttach()->valideRead();
        if (($stream = stream_get_contents($this->stream)) === false) {
            throw new \RuntimeException('An error occurred while reading the stream.');
        }

        return $stream;
    }
1002021
public function eof()
    {
        $this->_ensureReadable();
        if ($this->_limit === null) {
            return feof($this->_resource);
        }
        $position = $this->tell();
        $max = $this->_start + $this->_limit;
        return $position >= $max;
    }
359668
public function stream_eof()
    {
        if ($this->fileHandle === null) {
            return false;
        }
        self::restore();
        $success = feof($this->fileHandle);
        self::register();
        return $success;
    }
979696
public function eof()
    {
        return !$this->_streams || ($this->_current >= count($this->_streams) - 1 && $this->_streams[$this->_current]->eof());
    }
800912
public function end()
    {
        if ($this->parent) {
            $this->parent->addCriterion($this);
            return $this->parent->end();
        }
        return $this->slave;
    }
909582
public function is_finished() {

        if ($this->finished === null) {
            $endtime = $this->get_end();
            if ($endtime === 0 || $this->now < $endtime) {
                // It is not yet finished or no idea when it finishes.
                $this->finished = false;
            } else {
                $this->finished = true;
            }
        }

        return $this->finished;
    }
196457
protected function end()
    {
        if ($this->matchChar(';')) {
            return true;
        }

        if ($this->count === strlen($this->buffer) || $this->buffer[$this->count] === '}') {
            // if there is end of file or a closing block next then we don't need a ;
            return true;
        }

        return false;
    }
345097
private function isDataOnStream()
    {
        $read = [$this->connection];
        $write = null;
        $except = null;
        $hasStreamInfo = @stream_select($read, $write, $except, 0);

        if ($hasStreamInfo === false) {
            // can return `false` if used in combination with `pcntl_signal` and lead to false errors here
            $error = error_get_last();
            if ($error && isset($error['message']) && stripos($error['message'], 'interrupted system call') === false) {
                throw new ConnectionException(
                    'Check failed to determine if the socket is readable.',
                    $this->activeHost
                );
            }
            return null;
        }

        return !empty($read);
    }
49623
public function isComplete()
    {
        if (!$this->buffer) {
            return false;
        }

        try {
            return $this->getBufferLength() >= $this->getExpectedBufferLength();
        } catch (FrameException $e) {
            return false;
        }
    }
5699
public function stream_flush()
    {
        if ($this->fileHandle === null) {
            return false;
        }
        self::restore();
        $success = fflush($this->fileHandle);
        self::register();
        return $success;
    }