Reads File with synchronized atom time difference.
@access		protected
@return		void
345230
protected function readSyncFile()
	{
		if( !file_exists( $this->syncFile ) )
			$this->synchronize();
		$ir = new FS_File_INI_Reader ($this->syncFile, false);
		$data = $ir->getProperties (true);
		$this->syncTime	= $data['time'];
		$this->syncDiff	= $data['diff'];
	}
162917
public function read()
    {

        // if file is readable
        if ($this->readable !== true) return false;

        if (!empty($this->fp) && is_resource($this->fp)) fclose($this->fp);

        $this->open_fp('r');

        if (filesize($this->file) == 0) return false;
        $this->lock(LOCK_SH);

        $content = (string)fread($this->fp, ($this->size >= 0) ? $this->size : 1);

        $this->lock(LOCK_UN);

        return $content;
    }
939299
protected function read($file)
    {
        $data = null;
        $key  = $file;
        $file = $this->getFileName($file);

        if ( file_exists($file))
        {
            // if cache file not expire
            if (filemtime($file) >= time())
            {
                echo "read cache<br/>";
                $data = file_get_contents($file);
                $data = ($this->base64Encode) ? base64_decode($data) : $data;
                $data = unserialize($data);
                static::$keys[$key] = true;
            }
            else
            {
                unset(static::$keys[$key]);
                unlink($file);
            }
        }

        return $data;
    }
1304168
public function read()
    {
        $args = array_merge(
            [$this->filename],
            [false, null],
            func_get_args()
        );

        return file_get_contents(...$args);
    }
629138
private function tryReadFile($path) {
        if (!file_exists($path)) {
            return false;
        }

        $interval = 100000;
        $totalTime = 0;

        while (($result = file_get_contents($path)) === false) {
            if ($totalTime >= $this->accessTime) {
                return false;
            }

            usleep($interval);

            $totalTime += $interval;
        }

        return $result;
    }
825633
public function readDate()
    {
        // get the unix time stamp. Not sure why ActionScript does not use
        // milliseconds
        $timestamp = floor($this->_stream->readDouble() / 1000);

        // The timezone offset is never returned to the server; it is always 0,
        // so read and ignore.
        $offset = $this->_stream->readInt();

        require_once 'Zend/Date.php';
        $date   = new Zend_Date($timestamp);
        return $date;
    }
842775
private function readCurrent() : void
    {
        $row = $this->readRow();

        if ($this->columns === null || $row === null) {
            $this->current = $row;
        } else {
            $this->current = [];

            foreach ($this->columns as $key => $name) {
                $this->current[$name] = isset($row[$key]) ? $row[$key] : null;
            }
        }
    }
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;
    }
53300
public function getLastChanged(): \DateTime
    {
        \clearstatcache();
        if (false === $ctime = \filectime($this->filename)) {
            throw new TimeCanNotBeReadException('Time of last change can not be read.');
        }
        return (new \DateTime())->setTimestamp($ctime);
    }
575457
public function loadLastRunTime()
	{
		$date = NULL;
		$filepath = $this->buildFilePath();
		if (file_exists($filepath)) {
			$date = file_get_contents($filepath);
			$date = DateTime::createFromFormat(self::DATETIME_FORMAT, $date);
		}

		return $date ? $date : NULL;
	}
684951
public function getLastAccessed(): \DateTime
    {
        \clearstatcache();
        if (false === $atime = \fileatime($this->filename)) {
            throw new TimeCanNotBeReadException('Last access time can not be read.');
        }
        return (new \DateTime())->setTimestamp($atime);
    }
498605
public function read(): ?TimePoint
    {
        try {
            $datetime = new DateTime($this->current, $this->timezone);
        } catch (BaseException $e) {
            return null;
        }

        return $this->fromDateTime($datetime);
    }
324932
private function read()
    {
        $this->lock();

        $data = '';

        rewind($this->handle);

        $data = trim(stream_get_contents($this->handle));

        if ($data !== '') {
            $this->data = unserialize($data);
            $data = null;
        }

        flock($this->handle, LOCK_UN);

        $this->iterator = new \ArrayIterator($this->data);
    }
234459
public function actionReadFile()
	{
        $target_path = $this->get['path'];
		$target_fullpath = $this->getFullPath($target_path, true);
        Log::info('reading file "' . $target_fullpath . '"');

        if(is_dir($target_fullpath)) {
            $this->error('FORBIDDEN_ACTION_DIR');
        }

        // check if the name is not in "excluded" list
        if(!$this->is_allowed_name($target_fullpath, false)) {
            $this->error('INVALID_DIRECTORY_OR_FILE');
        }

		$filesize = filesize($target_fullpath);
		$length = $filesize;
		$context = null;

		if(isset($_SERVER['HTTP_RANGE'])) {
			if(!preg_match('/bytes=(\d+)-(\d+)?/', $_SERVER['HTTP_RANGE'], $matches)) {
				header('HTTP/1.1 416 Requested Range Not Satisfiable');
				header('Content-Range: bytes */' . $filesize);
				exit;
			}

			$offset = intval($matches[1]);

			if(isset($matches[2])) {
				$end = intval($matches[2]);
				if($offset > $end) {
					header('HTTP/1.1 416 Requested Range Not Satisfiable');
					header('Content-Range: bytes */' . $filesize);
					exit;
				}
				$length = $end - $offset;
			} else {
				$length = $filesize - $offset;
			}

			$bytes_start = $offset;
			$bytes_end = $offset + $length - 1;
			$context = stream_context_create([
				's3' => [
					'seekable' => true,
					'Range' => "bytes={$bytes_start}-{$bytes_end}",
				]
			]);

			header('HTTP/1.1 206 Partial Content');
			// A full-length file will indeed be "bytes 0-x/x+1", think of 0-indexed array counts
			header('Content-Range: bytes ' . $bytes_start . '-' . $bytes_end . '/' . $filesize);
			// While playing media by direct link (not via FM) FireFox and IE doesn't allow seeking (rewind) it in player
			// This header can fix this behavior if to put it out of this condition, but it breaks PDF preview
			header('Accept-Ranges: bytes');
		}

		header('Content-Type: ' . $this->getMimeType($target_fullpath));
		header("Content-Transfer-Encoding: binary");
		header("Content-Length: " . $length);
		header('Content-Disposition: inline; filename="' . basename($target_fullpath) . '"');

		readfile($target_fullpath, null, $context);
		exit;
	}
676326
public function stream_read($bytes)
    {
        if (!$this->currentlyOpenedFile->isOpenedForReading()) {
            return null;
        }
        $data = $this->currentlyOpenedFile->read($bytes);
        //file access time changes so stat cache needs to be cleared
        clearstatcache();

        return $data;
    }
38353
protected function readFrame(): void
    {
        $header = $this->forceRead(8);

        if (\strlen($header) < 8) {
            return;
        }

        $decoded = \unpack('C1type/C3/N1size', $header);
        $output = $this->forceRead($decoded['size']);
        $callbackList = [];

        if (0 === $decoded['type']) {
            $callbackList = $this->onStdinCallables;
        }

        if (1 === $decoded['type']) {
            $callbackList = $this->onStdoutCallables;
        }

        if (2 === $decoded['type']) {
            $callbackList = $this->onStderrCallables;
        }

        foreach ($callbackList as $callback) {
            $callback($output);
        }
    }
1308377
protected function getMicrotime(): float
    {
        list ($uSec, $sec) = \explode(' ', \microtime());
        return ((float)$uSec + (float)$sec);
    }