File_Archive
[ class tree: File_Archive ] [ index: File_Archive ] [ all elements ]

Source for file Archive.php

Documentation is available at Archive.php

  1. <?
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3.  
  4. /**
  5.  * Base class for all the transformation writers that will generate one single
  6.  * file
  7.  *
  8.  * PHP versions 4 and 5
  9.  *
  10.  * This library is free software; you can redistribute it and/or
  11.  * modify it under the terms of the GNU Lesser General Public
  12.  * License as published by the Free Software Foundation; either
  13.  * version 2.1 of the License, or (at your option) any later version.
  14.  *
  15.  * This library is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18.  * Lesser General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU Lesser General Public
  21.  * License along with this library; if not, write to the Free Software
  22.  * Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA
  23.  *
  24.  * @category   File Formats
  25.  * @package    File_Archive
  26.  * @author     Vincent Lascaux <vincentlascaux@php.net>
  27.  * @copyright  1997-2005 The PHP Group
  28.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL
  29.  * @version    CVS: $Id: Archive.php,v 1.9 2005/04/15 21:52:02 vincentlascaux Exp $
  30.  * @link       http://pear.php.net/package/File_Archive
  31.  */
  32.  
  33. require_once "File/Archive/Writer.php";
  34.  
  35. /**
  36.  * Base class for all the transformation writers that will generate one single
  37.  * file
  38.  */
  39. class File_Archive_Writer_Archive extends File_Archive_Writer
  40. {
  41.     /**
  42.      * @var File_Archive_Writer The compressed data will be written to this
  43.      * writer
  44.      * @access protected
  45.      */
  46.     var $innerWriter;
  47.  
  48.     /**
  49.      * @var bool If true, the innerWriter will be closed when closing this
  50.      * @access private
  51.      */
  52.     var $autoClose;
  53.  
  54.     /**
  55.      * @param String $filename Name to give to the archive (the name will
  56.      * probably be used by the inner writer)
  57.      *
  58.      * @param File_Archive_Writer $innerWriter The inner writer to which the
  59.      *        compressed data will be written
  60.      * @param array $stat The stat of the archive (see the PHP stat() function).
  61.      *        No element are required in this array
  62.      * @param bool $autoClose Indicate if the inner writer must be closed when
  63.      *        closing this
  64.      */
  65.     function File_Archive_Writer_Archive($filename, &$innerWriter,
  66.                                          $stat = array(), $autoClose = true)
  67.     {
  68.         $this->innerWriter =& $innerWriter;
  69.         $this->autoClose = $autoClose;
  70.         $this->innerWriter->newFile($filename, $stat, $this->getMime());
  71.     }
  72.  
  73. //MUST REWRITE FUNCTIONS
  74.     //function newFile($filename, $stat, $mime) { }
  75.  
  76.     /**
  77.      * @return the MIME extension of the files generated by this writer
  78.      */
  79.     function getMime() { return "application/octet-stream"; }
  80.  
  81.     /**
  82.      * @see File_Archive_Writer::close()
  83.      */
  84.     function close()
  85.     {
  86.         if ($this->autoClose) {
  87.             return $this->innerWriter->close();
  88.         }
  89.     }
  90. //  function writeData($data)
  91.  
  92. //SHOULD REWRITE FUNCTIONS
  93. //  function writeFile($filename)
  94. }
  95.  
  96. ?>

Documentation generated on Mon, 11 Mar 2019 14:21:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.