Archive_Tar::_readBlock PHP Method

_readBlock() public method

{{{ _readBlock()
public _readBlock ( )
    function _readBlock()
    {
        $v_block = null;
        if (is_resource($this->_file)) {
            if ($this->_compress_type == 'gz') {
                $v_block = @gzread($this->_file, 512);
            } else {
                if ($this->_compress_type == 'bz2') {
                    $v_block = @bzread($this->_file, 512);
                } else {
                    if ($this->_compress_type == 'none') {
                        $v_block = @fread($this->_file, 512);
                    } else {
                        $this->_error('Unknown or missing compression type (' . $this->_compress_type . ')');
                    }
                }
            }
        }
        return $v_block;
    }

Usage Example

示例#1
0
 function _getSize($p_len = null)
 {
     static $count = 0;
     if ($this->tarSize) {
         return;
     }
     $currentBlock = $this->_getOffset($p_len);
     while (strlen(parent::_readBlock($p_len))) {
         $this->_jumpBlock(1024);
         $tarSize = $this->_getOffset($p_len);
         if ($tarSize > 0) {
             $this->tarSize = $tarSize;
         } else {
             break;
         }
         if (++$count > 128) {
             $count = 0;
             $this->setState($this->resumeOffset);
         }
     }
     $this->_rewind();
     $this->_jumpBlock($currentBlock);
 }