Returns the current position of the file read/write handle

@return int Position of the file handle
@throws \RuntimeException on error.
504338
public function tell()
    {
        if (!$this->isClosed()) {
            $pos = ftell($this->handle);
        }
        
        if (!isset($pos) || $pos === false) {
            throw new \RuntimeException("Failed to get the position of the stream");
        }
        
        return $pos;
    }
215272
public function getRememberedPosition()
    {
        if (!$this->ableToFormat) {
            return $this->originalPosition;
        }

        $accruedInputIndex = 0;
        $currentOutputIndex = 0;
        $currentOutputLength = mb_strlen($this->currentOutput);
        while ($accruedInputIndex < $this->positionToRemember && $currentOutputIndex < $currentOutputLength) {
            if (mb_substr($this->accruedInputWithoutFormatting, $accruedInputIndex, 1) == mb_substr($this->currentOutput, $currentOutputIndex, 1)) {
                $accruedInputIndex++;
            }
            $currentOutputIndex++;
        }
        return $currentOutputIndex;
    }
427489
public function getIndexData() {
		if ($this->index === null) {
			$currentPointer = ftell($this->file);
			fseek($this->file, 0);
			
			$count       = 0;
			$this->index = [];
			
			while (fgets($this->file) !== false) {
				$this->index[++ $count] = ftell($this->file);
			}

			fseek($this->file, $currentPointer);
		}
		
		return $this->index;
	}
831063
public function filesize()
	{
		if (!$this->filename)
		{
			throw new \RuntimeException('File not open');
		}

		// Capture PHP errors
		$php_errormsg = '';
		$track_errors = ini_get('track_errors');
		ini_set('track_errors', true);
		$res = @filesize($this->filename);

		if (!$res)
		{
			$tmp_error = '';

			if ($php_errormsg)
			{
				// Something went wrong.
				// Store the error in case we need it.
				$tmp_error = $php_errormsg;
			}

			$res = Helper::remotefsize($this->filename);

			if (!$res)
			{
				if ($tmp_error)
				{
					// Use the php_errormsg from before
					throw new \RuntimeException($tmp_error);
				}
				else
				{
					// Error but nothing from php? How strange! Create our own
					throw new \RuntimeException('Failed to get file size. This may not work for all streams.');
				}
			}
			else
			{
				$this->filesize = $res;
				$retval = $res;
			}
		}
		else
		{
			$this->filesize = $res;
			$retval = $res;
		}

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

		// Return the result
		return $retval;
	}
411536
public function current()
    {
        $line = fgets($this->handle);
        $this->length = strlen($line);
        fseek($this->handle, $this->offset);

        return $line;
    }
135967
protected function getFileResource()
    {
        if (null === $this->fileResource) {
            $fileResource = @fopen($this->getFileName(), 'a+');
            if (! $fileResource) {
                throw new RuntimeException('Could not open pidfile');
            }
            $this->fileResource = $fileResource;
        }

        return $this->fileResource;
    }
71704
protected function getFileToBeReplaced()
    {
        if ($this->fileToBeReplaced === false) {
            $fID = $this->request->request->get('fID');
            if (!$fID) {
                $this->fileToBeReplaced = null;
            } else {
                $fID = is_scalar($fID) ? (int) $fID : 0;
                $file = $fID === 0 ? null : $this->app->make(EntityManagerInterface::class)->find(FileEntity::class, $fID);
                if ($file === null) {
                    throw new UserMessageException(t('Unable to find the specified file.'));
                }
                $fp = new Checker($file);
                if (!$fp->canEditFileContents()) {
                    throw new UserMessageException(t('You do not have permission to modify this file.'));
                }
                $this->fileToBeReplaced = $file;
            }
        }

        return $this->fileToBeReplaced;
    }
318774
private function readNumber()
    {
        // Open
        if (false === $this->handle = fopen($this->path, 'c+')) {
            throw new RuntimeException("Failed to open file {$this->path}.");
        }
        // Exclusive lock
        if (!flock($this->handle, LOCK_EX)) {
            throw new RuntimeException("Failed to lock file {$this->path}.");
        }

        if (false !== $number = fread($this->handle, 10)) {
            return intval($number);
        }

        return 0;
    }
895811
public function getStatus()
    {
        /** @var $result CallResult */
        $result = $this->getSvn()->{'status'}($this->getRepositoryPath(), array(
            '--xml'
        ));
        $result->assertSuccess(
            sprintf('Cannot retrieve status from "%s"', $this->getRepositoryPath())
        );

        $xml    = simplexml_load_string($result->getStdOut());
        if (!$xml) {
            throw new \RuntimeException(sprintf('Cannot read status XML for "%s"', $this->getRepositoryPath()));
        }

        $status = array();
        foreach ($xml->xpath('/status/target/entry') as $entry) {
            $status[]   = array(
                'file'      => (string)$entry['path'],
                'status'    => (string)$entry->{'wc-status'}['item']
            );
        }
        return $status;
    }
520592
public function eof()
    {
        if($this->getType() == 'memory') {
            $result = $this->_position >= $this->_length;
        } else {
            $result = parent::eof();
        }

        return $result;
    }
395720
function tell()
    {
        if (!$this->_assertUsable())
            throw new \RuntimeException('No resource available; cannot tell position');

        if (false === $r = ftell($this->rHandler))
            throw new \RuntimeException('Unable to determine stream position');

        return $r;
    }
593790
@Override
    public int position() {
        // if we are in transferTo mode, then this is the FileChannel position
        if (isFCEnabled()) {
            try {
                return (int) fc.position();
            } catch (IOException e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Exception in position(): " + e);
                }
                FFDCFilter.processException(e, CLASS_NAME + ".position", "656", this);
                throw new RuntimeException(e);
            }
        }
        return super.position();
    }
932941
public function getPosition(): int
    {
        if ( ! is_resource($this->stream) ) {
            throw new StreamException('Stream is not longer available');
        }

        $result = ftell($this->stream);

        if ( $result === false ) {
            throw new StreamException('Unable to determine stream position');
        }

        return $result;
    }
81256
public function current()
    {
        if (isset($this->buffer[$this->position])) {
            return $this->buffer[$this->position];
        }
        $this->ensurePosition();
        $data = $this->resultSet->current();
        $this->buffer[$this->position] = $data;
        return $data;
    }
739160
public function tell()
    {
        if (!$this->stream) {
            throw new RuntimeException('No stream');
        }

        $position = ftell($this->stream);
        if (!$position) {
            throw new RuntimeException('Cannot get current position');
        }

        return $position;
    }
468394
public function getOffset()
    {
        $this->assertSeekable();
        $ret = ftell($this->stream);
        if (false === $ret) {
            throw new RuntimeException('Cannot get offset of stream');
        }
        
        return $ret;
    }
1082685
public function current()
    {
        /** @var SplFileInfo $file */
        $file = $this->getInnerIterator()->current();
        $filePathName = $file->getPathname();

        // Trim prefix + 1 for leading /
        return substr( $filePathName, strlen( $this->prefix ) + 1 );
    }