Source for file Concat.php
Documentation is available at Concat.php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
* A reader that concatene the data of the files of a source
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA
* @author Vincent Lascaux <vincentlascaux@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version CVS: $Id: Concat.php,v 1.5 2005/02/24 10:48:56 vincentlascaux Exp $
* @link http://pear.php.net/package/File_Archive
require_once "Relay.php";
* This reader provides one single file that is the concatenation of the data of
* all the files of another reader
class File_Archive_Reader_Concat extends File_Archive_Reader
function File_Archive_Reader_Concat(&$source, $filename,
$stat=array(), $mime=null)
$this->source =& $source;
$this->filename = $filename;
//Compute the total length
while (($error = $source->next()) === true) {
$sourceStat = $source->getStat();
$this->stat[7] += $sourceStat[7];
if (PEAR::isError($error) || PEAR::isError($source->close())) {
die("Error in File_Archive_Reader_Concat constructor ".
"({$error->getMessage()}), cannot continue");
* @see File_Archive_Reader::next()
return $this->opened = $this->source->next();
* @see File_Archive_Reader::getFilename()
function getFilename() { return $this->filename; }
* @see File_Archive_Reader::getStat()
function getStat() { return $this->stat; }
* @see File_Archive_Reader::getMime()
return $this->mime==null ? parent::getMime() : $this->mime;
* @see File_Archive_Reader::getData()
function getData($length = -1)
while ($length == -1 || strlen($result)<$length) {
$sourceData = $this->source->getData(
$length==-1 ? -1 : $length - strlen($result)
if (PEAR::isError($sourceData)) {
if ($sourceData == null) {
$error = $this->source->next();
if (PEAR::isError($error)) {
return $result == '' ? null : $result;
* @see File_Archive_Reader::skip()
while ($skipped < $length) {
$sourceSkipped = $this->source->skip($length);
if (PEAR::isError($sourceSkipped)) {
$skipped += $sourceSkipped;
* @see File_Archive_Reader::close()
$error = $this->source->close();
if (PEAR::isError($error)) {
Documentation generated on Mon, 11 Mar 2019 14:21:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|