Lines Matching refs:this

36         $this->compressioncheck($type);
40 $this->comptype = $type;
41 $this->complevel = $level;
42 if($level == 0) $this->comptype = Archive::COMPRESS_NONE;
43 if($type == Archive::COMPRESS_NONE) $this->complevel = 0;
55 $this->file = $file;
58 if ($this->comptype == Tar::COMPRESS_AUTO) {
59 $this->setCompression($this->complevel, $this->filetype($file));
63 if ($this->comptype === Archive::COMPRESS_GZIP) {
64 $this->fh = @gzopen($this->file, 'rb');
65 } elseif ($this->comptype === Archive::COMPRESS_BZIP) {
66 $this->fh = @bzopen($this->file, 'r');
68 $this->fh = @fopen($this->file, 'rb');
71 if (!$this->fh) {
72 throw new ArchiveIOException('Could not open file for reading: '.$this->file);
74 $this->closed = false;
93 foreach ($this->yieldContents() as $fileinfo) {
111 if ($this->closed || !$this->file) {
115 while ($read = $this->readbytes(512)) {
116 $header = $this->parseHeader($read);
121 $this->skipbytes(ceil($header['size'] / 512) * 512);
122 yield $this->header2fileinfo($header);
125 $this->close();
135 * Alternatively a fixed string prefix may be passed in $strip. If the filename matches this prefix,
138 * By default this will extract all files found in the archive. You can restrict the output using the $include
140 * $include is set only files that match this expression will be extracted. Files that match the $exclude
157 if ($this->closed || !$this->file) {
168 while ($dat = $this->readbytes(512)) {
170 $header = $this->parseHeader($dat);
174 $fileinfo = $this->header2fileinfo($header);
181 $this->skipbytes(ceil($header['size'] / 512) * 512);
201 fwrite($fp, $this->readbytes(512), 512);
204 fwrite($fp, $this->readbytes(512), $header['size'] % 512);
211 $this->skipbytes(ceil($header['size'] / 512) * 512); // the size is usually 0 for directories
214 if(is_callable($this->callback)) {
215 call_user_func($this->callback, $fileinfo);
220 $this->close();
235 $this->file = $file;
236 $this->memory = '';
237 $this->fh = 0;
239 if ($this->file) {
241 if ($this->comptype == Archive::COMPRESS_AUTO) {
242 $this->setCompression($this->complevel, $this->filetype($file));
245 if ($this->comptype === Archive::COMPRESS_GZIP) {
246 $this->fh = @gzopen($this->file, 'wb'.$this->complevel);
247 } elseif ($this->comptype === Archive::COMPRESS_BZIP) {
248 $this->fh = @bzopen($this->file, 'w');
250 $this->fh = @fopen($this->file, 'wb');
253 if (!$this->fh) {
254 throw new ArchiveIOException('Could not open file for writing: '.$this->file);
257 $this->writeaccess = true;
258 $this->closed = false;
276 if ($this->closed) {
281 $this->writeFileHeader($fileinfo);
302 $this->writebytes($packed);
307 $this->close();
312 if(is_callable($this->callback)) {
313 call_user_func($this->callback, $fileinfo);
330 if ($this->closed) {
336 $this->writeFileHeader($fileinfo);
339 $this->writebytes(pack("a512", substr($data, $s, 512)));
342 if (is_callable($this->callback)) {
343 call_user_func($this->callback, $fileinfo);
350 * After a call to this function no more data can be added to the archive, for
361 if ($this->closed) {
363 } // we did this already
366 if ($this->writeaccess) {
367 $this->writebytes(pack("a512", ""));
368 $this->writebytes(pack("a512", ""));
372 if ($this->file) {
373 if ($this->comptype === Archive::COMPRESS_GZIP) {
374 gzclose($this->fh);
375 } elseif ($this->comptype === Archive::COMPRESS_BZIP) {
376 bzclose($this->fh);
378 fclose($this->fh);
381 $this->file = '';
382 $this->fh = 0;
385 $this->writeaccess = false;
386 $this->closed = true;
397 $this->close();
399 if ($this->comptype === Archive::COMPRESS_AUTO) {
400 $this->comptype = Archive::COMPRESS_NONE;
403 if ($this->comptype === Archive::COMPRESS_GZIP) {
404 return gzencode($this->memory, $this->complevel);
406 if ($this->comptype === Archive::COMPRESS_BZIP) {
407 return bzcompress($this->memory);
409 return $this->memory;
424 if ($this->comptype === Archive::COMPRESS_AUTO) {
425 $this->setCompression($this->complevel, $this->filetype($file));
428 if (!@file_put_contents($file, $this->getArchive())) {
441 if ($this->comptype === Archive::COMPRESS_GZIP) {
442 return @gzread($this->fh, $length);
443 } elseif ($this->comptype === Archive::COMPRESS_BZIP) {
444 return @bzread($this->fh, $length);
446 return @fread($this->fh, $length);
459 if (!$this->file) {
460 $this->memory .= $data;
462 } elseif ($this->comptype === Archive::COMPRESS_GZIP) {
463 $written = @gzwrite($this->fh, $data);
464 } elseif ($this->comptype === Archive::COMPRESS_BZIP) {
465 $written = @bzwrite($this->fh, $data);
467 $written = @fwrite($this->fh, $data);
480 * @param int $bytes seek to this position
484 if ($this->comptype === Archive::COMPRESS_GZIP) {
485 @gzseek($this->fh, $bytes, SEEK_CUR);
486 } elseif ($this->comptype === Archive::COMPRESS_BZIP) {
491 @bzread($this->fh, $toread);
495 @fseek($this->fh, $bytes, SEEK_CUR);
507 $this->writeRawFileHeader(
540 $this->writeRawFileHeader('././@LongLink', 0, 0, 0, $namelen, 0, 'L');
542 $this->writebytes(pack("a512", substr($name, $s, 512)));
570 $this->writebytes($data_first);
573 $this->writebytes($chks.$data_last);
580 * @return array|false returns false when this was a null block
632 $filename = trim($this->readbytes(ceil($return['size'] / 512) * 512));
634 $block = $this->readbytes(512);
635 $return = $this->parseHeader($block);
687 * You don't need to call this yourself. It's used when you pass Archive::COMPRESS_AUTO somewhere