Write down the currently loaded Tar Archive.
@access		public
@param		string	$fileName 	Name of Tar Archive to save
@return		int					Number of written bytes
422457
public function save( $fileName = NULL )
	{
		if( empty( $fileName ) )
		{
			if( empty( $this->fileName ) )
				throw new Exception( 'No TAR file name for saving given' );
			$fileName = $this->fileName;
		}
		$this->generateZip();																		// Encode processed files into TAR file format
		return File_Writer::save( $fileName, $this->content );										//  write archive file
	}
184182
protected function saveRuntime($filename)
    {
        $payload = [
            'name' => $this->laravel->name(),
            'pid'  => getmypid(),
            'time' => (string) Carbon::now(),
        ];

        file_put_contents($filename, json_encode($payload, JSON_PRETTY_PRINT));
    }
471193
public function addFile( $fileName )
	{
		if( !file_exists( $fileName ) )													// Make sure the file we are adding exists!
			throw new Exception( 'File "'.$fileName.'" is not existing' );
		if( $this->containsFile( $fileName ) )											// Make sure there are no other files in the archive that have this same fileName
			throw new Exception( 'File "'.$fileName.'" already existing in TAR' );

		$fileName	= str_replace( "\\", "/", $fileName );
		$fileName	= str_replace( "./", "", $fileName );
		$fileInfo	= stat( $fileName );												// Get file information
		$file		= new File_Reader( $fileName );

		$this->numFiles++;																// Add file to processed data
		$activeFile					= &$this->files[];
		$activeFile['name']			= $fileName;
		$activeFile['mode']			= $fileInfo['mode'];
		$activeFile['user_id']		= $fileInfo['uid'];
		$activeFile['group_id']		= $fileInfo['gid'];
		$activeFile['size']			= $fileInfo['size'];
		$activeFile['time']			= $fileInfo['mtime'];
#		$activeFile['checksum']		= $checksum;
		$activeFile['user_name']	= '';
		$activeFile['group_name']	= '';
		$activeFile['file']			= $file->readString();								// Read in the file's contents
		return TRUE;
	}
95946
public function getFileContent($fileName)
    {
        $result = $this->zip->getFromName($fileName);
        if ($result === false)
            throw new Exception('Could not get file information: '.$result);
        return $result;
    }
756198
public function getFileData($fileName)
    {
        $entry = $this->sevenZip->getEntry($fileName);
        return new ArchiveEntry($fileName, $entry->getPackedSize(), $entry->getSize(),
            strtotime($entry->getModified()));
    }
294576
public static function getFileExtAttr($filename) {
        if (file_exists($filename)) {
            $fp = fileperms($filename) << 16;
            return $fp | (is_dir($filename) ? self::S_DOS_D : self::S_DOS_A);
        }
        return FALSE;
    }
606531
public function write($filename)
    {
        if ($this->isDirty && $this->bytes) {
            return file_put_contents($filename, $this->bytes);
        }
        if ($this->isDirty && $this->filename) {
            return copy($this->filename, $filename);
        }
        if ($this->riakGridFSFile instanceof \RiakGridFSFile) {
            return $this->riakGridFSFile->write($filename);
        }
        throw new \BadMethodCallException('Nothing to write(). File is not persisted yet and is not dirty.');
    }
722806
public function toFile($filename)
    {
        $directory = dirname($filename);

        if(empty($filename)) {
            throw new \InvalidArgumentException('No file name specified');
        }

        if (!is_dir($directory)) {
            throw new \RuntimeException(sprintf('Directory : %s does not exists!', $directory));
        }

        if (!is_writable($directory)) {
            throw new \RuntimeException(sprintf("Cannot write in directory : %s", $directory));
        }

        $result = file_put_contents($filename, $this->toString(), LOCK_EX);

        if($result === false) {
            throw new \RuntimeException(sprintf("Error writing to %s", $filename));
        }
    }
506609
public function read($fileName)
    {
        $path = $this->getPathBase($fileName);

        if (!file_exists($path)) {
            return;
        }

        $data = file_get_contents($path);
        return $this->data = unserialize($data);
    }
30854
public static function readfileChunked($filename)
    {
        $chunksize = 1024 * 10; // how many bytes per chunk

        $handle = fopen($filename, 'rb');
        if ($handle === false) {
            return false;
        }
        while (!feof($handle)) {
            echo fread($handle, $chunksize);
            @ob_flush();
            flush();
            @set_time_limit(8);
        }
        fclose($handle);
        return true;
    }
335781
protected static function loadFileInMemory($fileName)
  {
    if (!preg_match('/\.ini$/i', $fileName)) {
      $fileName .= '.ini';
    }
    $found = 0;
    foreach (self::$storages as $priority => $substorages) {
      foreach ($substorages as $storage) {
        $data = parse_ini_file(sprintf('%s/%s/%s', $storage, self::$languageCode, $fileName));
        if ($data) {
          self::$translations = array_merge(self::$translations, $data);
          $found++;
        }
      }
    }
    return $found != 0;
  }
379771
public static function write($filename, $content, $mode = 0666)
    {
        self::ensureFileSystem()->dumpFile($filename, $content, $mode);
    }
946867
public function logDownload($fileName)
	{
		$this->_filename = $fileName;
		
		if (isset($GLOBALS['TL_CONFIG']['dlstats']) && 
           (bool) $GLOBALS['TL_CONFIG']['dlstats'] === true)
		{
			if (true  === $this->DL_LOG &&
			    false === $this->checkMultipleDownload($fileName) 
               )
			{
				$this->logDLStats();
				$this->logDLStatDetails();
			}
		}
	}
802524
public function export_to_file($filename)
    {
        $fh = fopen($filename, 'wb');
        if (!$fh) {
            return false;
        }
        $res = $this->export_to_file_handle($fh);
        fclose($fh);

        return $res;
    }
114745
public function locateName($fileName)
    {
        $list = $this->zip->listContent();
        $listCount = count($list);
        $list_index = -1;
        for ($i = 0; $i < $listCount; ++$i) {
            if (strtolower($list[$i]["filename"]) == strtolower($fileName) ||
                strtolower($list[$i]["stored_filename"]) == strtolower($fileName)) {
                $list_index = $i;
                break;
            }
        }
        return ($list_index > -1);
    }
343403
public function store($filename, $filext=DEFAULTS::EXTENSION)
    {	
      return FileHandler::save($filename, $this->data);
    }
53817
public function write( $fileName, $encoding = "utf-8" )
	{
		return $this->save( $fileName, $this->channelData, $this->itemList, $encoding );
	}