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

Class: File_Archive_Reader

Source Location: /File_Archive-0.2.0/File/Archive/Reader.php

Class Overview


Abstract base class for all the readers


Methods


Child classes:

File_Archive_Reader_Archive
Base class for all the archive readers (that read from a single file)
File_Archive_Reader_Concat
This reader provides one single file that is the concatenation of the data of
File_Archive_Reader_File
Reader that represents a single file
File_Archive_Reader_Memory
A reader that takes its input from a memory buffer
File_Archive_Reader_Relay
This reader appear exactly as $source does

Inherited Variables

Inherited Methods


Class Details

[line 41]
Abstract base class for all the readers

A reader is a compilation of serveral files that can be read



[ Top ]


Method Detail

close   [line 185]


extract   [line 224]

void extract( File_Archive_Writer &$writer, [bool $autoClose = true], [int $bufferSize = 102400])

Sends the whole reader to $writer

Parameters:

File_Archive_Writer   $writer     Where to write the files of the reader
bool   $autoClose     If true, close $writer at the end of the function. Default value is true
int   $bufferSize     Size of the chunks that will be sent to the writer Default value is 100kB

[ Top ]

extractFile   [line 262]

void extractFile( string $filename, File_Archive_Writer &$writer, [bool $autoClose = true], [int $bufferSize = 102400])

Extract only one file (given by the URL)

Parameters:

string   $filename     URL of the file to extract from this
File_Archive_Writer   $writer     Where to write the file
bool   $autoClose     If true, close $writer at the end of the function Default value is true
int   $bufferSize     Size of the chunks that will be sent to the writer Default value is 100kB

[ Top ]

getData   [line 160]

void getData( [mixed $length = -1])

Reads some data from the current file

If the end of the file is reached, returns null If $length is not specified, reads up to the end of the file If $length is specified reads up to $length


Overridden in child classes as:

File_Archive_Reader_Gzip::getData()
File_Archive_Reader_Tar::getData()
File_Archive_Reader_Zip::getData()
File_Archive_Reader_Concat::getData()
File_Archive_Reader_File::getData()
File_Archive_Reader_Memory::getData()
File_Archive_Reader_Relay::getData()

[ Top ]

getDataFilename   [line 152]

the getDataFilename( )

If the current file of the archive is a physical file,
  • Return:

    name of the physical file containing the data or null if no such file exists

    The data filename may not be the same as the filename.


Overridden in child classes as:

File_Archive_Reader_File::getDataFilename()
File_Archive_Reader_Relay::getDataFilename()

[ Top ]

getFilename   [line 118]


getMime   [line 138]

void getMime( )

Returns the MIME associated with the current file

The default function does that by looking at the extension of the file


Overridden in child classes as:

File_Archive_Reader_Concat::getMime()
File_Archive_Reader_File::getMime()
File_Archive_Reader_Memory::getMime()
File_Archive_Reader_Relay::getMime()

[ Top ]

getStandardURL   [line 95]

void getStandardURL( string $path)

Returns the standard path

Changes \ to / Removes the .. and . from the URL

  • Static: This method can be called statically

Parameters:

string   $path     a valid URL that may contain . or .. and \

[ Top ]

getStat   [line 132]

void getStat( )

Returns an array of statistics about the file (see the PHP stat function for more information)

The only element that must be present in the array is the size (index 7) All the other element may not be present if the reader doesnt know about it


Overridden in child classes as:

File_Archive_Reader_Gzip::getStat()
File_Archive_Reader_Tar::getStat()
File_Archive_Reader_Zip::getStat()
File_Archive_Reader_Concat::getStat()
File_Archive_Reader_File::getStat()
File_Archive_Reader_Memory::getStat()
File_Archive_Reader_Relay::getStat()

[ Top ]

next   [line 48]


select   [line 61]

bool select( string $filename, [bool $close = true])

Move to the next file whose name is in directory $filename or is exactly $filename
  • Return: whether the file was found in the archive or not

Overridden in child classes as:

File_Archive_Reader_Uncompress::select()

Parameters:

string   $filename     Name of the file to find in the archive
bool   $close     If true, close the reader and search from the first file

[ Top ]

sendData   [line 194]

void sendData( mixed &$writer, [mixed $bufferSize = 102400])

Sends the current file to the Writer $writer

The data will be sent by chunks of at most $bufferSize bytes


[ Top ]

skip   [line 171]

void skip( mixed $length)

Skip some data and returns how many bytes have been skipped

This is strictly equivalent to return strlen(getData($length)) But could be far more efficient


Overridden in child classes as:

File_Archive_Reader_Gzip::skip()
File_Archive_Reader_Tar::skip()
File_Archive_Reader_Zip::skip()
File_Archive_Reader_Concat::skip()
File_Archive_Reader_File::skip()
File_Archive_Reader_Memory::skip()
File_Archive_Reader_Relay::skip()

[ Top ]


Documentation generated on Thu, 24 Feb 2005 12:50:20 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.