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

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