Esempio n. 1
0
 /**
  * @see File_Archive_Reader::next()
  */
 function next()
 {
     if (!parent::next()) {
         return false;
     }
     $this->nbRead++;
     if ($this->nbRead > 1) {
         return false;
     }
     $dataFilename = $this->source->getDataFilename();
     if ($dataFilename !== null) {
         $this->tmpName = null;
         $this->bzfile = @bzopen($dataFilename, 'r');
         if ($this->bzfile === false) {
             return PEAR::raiseError("bzopen failed to open {$dataFilename}");
         }
     } else {
         $this->tmpName = tempnam(File_Archive::getOption('tmpDirectory'), 'far');
         //Generate the tmp data
         $dest = new File_Archive_Writer_Files();
         $dest->newFile($this->tmpName);
         $this->source->sendData($dest);
         $dest->close();
         $this->bzfile = bzopen($this->tmpName, 'r');
     }
     return true;
 }
Esempio n. 2
0
 /**
  * @see File_Archive_Reader::next()
  */
 function next()
 {
     if (!parent::next()) {
         return false;
     }
     $this->nbRead++;
     $this->filePos = 0;
     if ($this->nbRead > 1) {
         return false;
     }
     $dataFilename = $this->source->getDataFilename();
     if ($dataFilename !== null) {
         $this->tmpName = null;
         $this->gzfile = gzopen($dataFilename, 'r');
     } else {
         $this->tmpName = tempnam(File_Archive::getOption('tmpDirectory'), 'far');
         //Generate the tmp data
         $dest = new File_Archive_Writer_Files();
         $dest->newFile($this->tmpName);
         $this->source->sendData($dest);
         $dest->close();
         $this->gzfile = gzopen($this->tmpName, 'r');
     }
     return true;
 }
Esempio n. 3
0
 /**
  * @see File_Archive_Reader::next()
  */
 function next()
 {
     $error = parent::next();
     if (PEAR::isError($error)) {
         return $error;
     }
     if ($this->rarFile === null) {
         $dataFilename = $this->source->getDataFilename();
         if ($dataFilename !== null) {
             $this->rarTmpName = null;
             $this->rarFile = rar_open($dataFilename);
         } else {
             $this->rarTmpName = tempnam(File_Archive::getOption('tmpDirectory'), 'far');
             //Generate the tmp data
             $dest = new File_Archive_Writer_Files();
             $dest->newFile($this->tmpName);
             $this->source->sendData($dest);
             $dest->close();
             $this->rarFile = rar_open($this->tmpName);
         }
         if (!$this->rarFile) {
             return PEAR::raiseError("Unable to open rar file {$dataFilename}");
         }
         if ($this->rarList === null) {
             $this->rarList = rar_list($this->rarFile);
             reset($this->rarList);
         }
     }
     if ($fileReader !== null) {
         $this->fileReader->close();
         $this->fileReader = null;
     }
     $entryName = next($this->rarList);
     $this->source = null;
     if ($entryName === false) {
         return false;
     }
     $this->rarEntry = rar_entry_get($this->rarFile, $entryName);
     if (!$this->rarEntry) {
         return PEAR::raiseError("Error reading entry {$entryName}");
     }
     return true;
 }
Esempio n. 4
0
 /**
  * @see File_Archive_Reader::makeWriterRemoveBlocks()
  */
 function makeWriterRemoveBlocks($blocks, $seek = 0)
 {
     require_once "File/Archive/Writer/Files.php";
     $writer = new File_Archive_Writer_Files();
     $file = $this->getDataFilename();
     $pos = $this->tell();
     $this->close();
     $writer->openFileRemoveBlock($file, $pos + $seek, $blocks);
     return $writer;
 }