Read the file
@return string
@throws FileOperationException
961508
public function readFile()
    {
        $this->openFile();
        $length = filesize($this->getFilePath());
        if($length === 0) return '';
        $read = fread($this->getFile(), $length);
        if($read === false)
        {
            throw FileOperationException::createForFailedToReadFromFile($this->getFilePath());
        }
        return $read;
    }
320836
public function getContents()
    {
        try {
            $fileObj = new SplFileObject($this->getName(true) , 'r');
        } catch ( RuntimeException $ex ) {
            throw new FileExistException('The provided file is not readable' , $ex);
        }

        return file_get_contents($fileObj->getPathname());
    }
1231834
public function getFormat()
    {
        try {
            $fileObj = new SplFileObject($this->getName(true) , 'r');
        } catch ( RuntimeException $ex ) {
            throw new FileExistException('The provided file is not readable' , $ex);
        }

        return $fileObj->getExtension();
    }
1026679
public function getFileContents()
    {
        $result = null;
        $fsl = $this->getFile()->getFileStorageLocationObject();
        if ($fsl !== null) {
            $app = Application::getFacadeApplication();
            $cf = $app->make('helper/concrete/file');
            try {
                $result = $fsl->getFileSystemObject()->read($cf->prefix($this->fvPrefix, $this->fvFilename));
                if ($result === false) {
                    $result = null;
                }
            } catch (FileNotFoundException $x) {
            }
        }

        return $result;
    }
613707
protected function readByte()
    {
        if (feof($this->fileHandler)) {
            return false;
        }

        $data = unpack('C1byte', fread($this->fileHandler, 1));
        $this->currentByte = $data['byte'];
        $this->currentBitPosition = 0;

        return true;
    }
645744
public function read_lockfile() {
		$retval = null;
		if($this->is_lockfile_present()) {
			$retval = file_get_contents($this->get_lockfile());
		}
		else {
			throw new \Exception(__METHOD__ .": no lockfile exists");
		}
		return($retval);
	}
487823
public byte read() throws IOException {
        if (current >= fsize) {
            throw new java.io.EOFException("Reached EOF, file size=" + fsize);
        }

        final byte ret = file[current++];
        return ret;
    }
1023293
function _read()
    {
        $fp = @fopen($this->_file, "rb");
        if ($fp) {
	    if ($this->_fileLocking) @flock($fp, LOCK_SH);
            clearstatcache();
            $length = @filesize($this->_file);
            $mqr = get_magic_quotes_runtime();
            if ($mqr) {
                set_magic_quotes_runtime(0);
            }
            if ($this->_readControl) {
                $hashControl = @fread($fp, 32);
                $length = $length - 32;
            }

            if ($length) {
                $data = '';
                // See https://bugs.php.net/bug.php?id=30936
                // The 8192 magic number is the chunk size used internally by PHP.
                while(!feof($fp)) $data .= fread($fp, 8192);
            } else {
                $data = '';
            }
            if ($mqr) {
                set_magic_quotes_runtime($mqr);
            }
            if ($this->_fileLocking) @flock($fp, LOCK_UN);
            @fclose($fp);
            if ($this->_readControl) {
                $hashData = $this->_hash($data, $this->_readControlType);
                if ($hashData != $hashControl) {
                    if (!(is_null($this->_lifeTime))) {
                        @touch($this->_file, time() - 2*abs($this->_lifeTime)); 
                    } else {
                        @unlink($this->_file);
                    }
                    return false;
                }
            }
            return $data;
        }
        return $this->raiseError('Cache_Lite : Unable to read cache !', -2); 
    }
877197
public function getExt()
    {
        if (is_null($this->ext) && $this->originFile) {
            $file = basename($this->originFile);
            // Use substr instead of pathinfo, because pathinfo may return error value in unicode
            if (false !== $pos = strrpos($file, '.')) {
                $this->ext = strtolower(substr($file, $pos + 1));
            } else {
                $this->ext = '';
            }
        }
        return $this->ext;
    }
1313755
public function get()
    {
        $handle   = fopen($this->filePath, "rb");
        $fileSize = filesize($this->filePath);

        $hash = array(
            3 => 0,
            2 => 0,
            1 => ($fileSize >> 16) & 0xFFFF,
            0 => $fileSize & 0xFFFF
        );

        for ($i = 0; $i < 8192; $i++) {
            $tmp  = $this->readUINT64($handle);
            $hash = $this->addUINT64($hash, $tmp);
        }

        $offset = $fileSize - 65536;
        fseek($handle, $offset > 0 ? $offset : 0, SEEK_SET);

        for ($i = 0; $i < 8192; $i++) {
            $tmp  = $this->readUINT64($handle);
            $hash = $this->addUINT64($hash, $tmp);
        }

        fclose($handle);

        return $this->uINT64FormatHex($hash);
    }
730313
protected function read_version_file() {
		$retval = NULL;
		
		//okay, all files present: check the version in the VERSION file.
		if(file_exists($this->versionFileLocation)) {
			$versionFileContents = file_get_contents($this->versionFileLocation);
			
			$versionMatches = array();
			preg_match_all('/\nVERSION: (.*)\n/', $versionFileContents, $versionMatches);
			if(count($versionMatches) == 2 && count($versionMatches[1]) == 1) {
				$this->versionFileVersion = $this->get_full_version_string(trim($versionMatches[1][0]));
				$retval = $this->versionFileVersion;

				//now retrieve the PROJECT name.
				$projectMatches = array();
				preg_match_all('/\nPROJECT: (.*)\n/', $versionFileContents, $projectMatches);
				if(count($projectMatches) == 2 && count($projectMatches[1]) == 1) {
					$this->projectName = trim($projectMatches[1][0]);
				}
				else {
					$this->error_handler(__METHOD__ .": failed to find PROJECT name");
				}
			}
			else {
				$this->error_handler(__METHOD__ .": could not find VERSION data");
			}
		}
		else {
			$this->error_handler(__METHOD__ .": Version file (". $this->versionFileLocation .") does not exist");
		}
		
		return($retval);
	}
1146553
public function getContents() : string
	{
		if (! \is_resource($this->resource))
		{
			throw new Exception\UnreadableStreamException('Stream is not resourceable');
		}

		if (! $this->isReadable())
		{
			throw new Exception\UnreadableStreamException('Stream is not readable');
		}

		$result = \stream_get_contents($this->resource);

		if (false === $result)
		{
			throw new Exception\UnreadableStreamException('Unable to read remainder of the stream');
		}

		return $result;
	}
541602
public function readLine(): string
	{
		if ($this->connected() === false)
		{
			throw new \Exception('Not connected');
		}

		$response = fgets($this->connection);

		if ($response === false)
		{
			throw new \Exception('Nothing to read');
		}

		return $response;
	}
510784
protected function readAccessToken()
    {
        if (!$this->getFileSystem()->isFile($this->getTokenFilePath())) {
            return '';
        }

        $content = trim($this->getFileSystem()->get($this->getTokenFilePath()));
        $result = json_decode($content, true);

        if (isset($result['token']) && isset($result['expire']) && isset($result['time'])) {
            $expireTime = $result['time'] + $result['expire'] - self::TOKEN_EXPIRE_SUB_TIME;
            if ($expireTime > time()) {
                return $result['token'];
            }
        }

        return '';
    }
498294
public function read()
    {
        if (!file_exists($this->path)) {
            throw new \RuntimeException('Could not read ' . $this->path);
        }
        return file_get_contents($this->path);
    }
288594
public function read()
    {
        if (!$this->connected()) {
            throw new LogicException('No connection');
        }

        $streams = [$this->connection];
        $write = $except = null;
        $streamsReadyToRead = stream_select($streams, $write, $except, 0, self::READ_TIMEOUT);
        if ($streamsReadyToRead > 0) {
            return stream_get_contents($this->connection);
        }
    }
357054
public function getFile()
    {
        if ($this->fileDetected) {
            return $this->file;
        }

        $this->handle = null;
        $file = &$this->file;

        if (!is_dir($this->dir) && !@mkdir($this->dir, 0755, true)) {
            $message = sprintf('Fail to create directory "%s"', $this->dir);
            ($e = error_get_last()) && $message .= ': ' . $e['message'];
            throw new \RuntimeException($message);
        }

        $file = realpath($this->dir) . '/' . date($this->fileFormat);

        if ($this->fileSize) {
            $firstFile = $file;

            $files = glob($file . '*', GLOB_NOSORT);

            if (1 < count($files)) {
                natsort($files);
                $file = array_pop($files);
            }

            if (is_file($file) && $this->fileSize < filesize($file)) {
                $ext = pathinfo($file, PATHINFO_EXTENSION);
                if (is_numeric($ext)) {
                    $file = $firstFile . '.' . ($ext + 1);
                } else {
                    $file = $firstFile . '.1';
                }
            }
        }

        $this->fileDetected = true;

        return $file;
    }