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

Class: File_Archive_Reader

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

Class Overview


Abstract base class for all the readers


Methods


Child classes:

File_Archive_Reader_Memory
A reader that takes its input from a memory buffer
File_Archive_Reader_File
Reader that represents a single file
File_Archive_Reader_Cache
This reader caches the files of another reader
File_Archive_Reader_Concat
This reader provides one single file that is the concatenation of the data of
File_Archive_Reader_Archive
Base class for all the archive readers (that read from a single file)
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 240]


extract   [line 286]

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

Sends the whole reader to $writer and close the reader

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 If $bufferSize <= 0 (default value), the blockSize option is used
   &$writer   — 

[ Top ]

extractFile   [line 332]

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

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 If $bufferSize <= 0 (default value), the blockSize option is used
   &$writer   — 

[ Top ]

getData   [line 190]


getDataFilename   [line 182]

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_Cache::getDataFilename()
File_Archive_Reader_Rar::getDataFilename()
File_Archive_Reader_Relay::getDataFilename()
File_Archive_Reader_Directory::getDataFilename()

[ Top ]

getFileList   [line 141]

array getFileList( )

Returns the list of filenames from the current pos to the end of the source The source will be closed after having called this function This function goes through the whole archive (which may be slow).

If you intend to work on the reader, doing it in one pass would be faster

  • Return: filenames from the current pos to the end of the source

Overridden in child classes as:

File_Archive_Reader_Rar::getFileList()
File_Archive_Reader_ChangeName::getFileList()
Returns the list of filenames from the current pos to the end of the source

[ Top ]

getFilename   [line 128]

string getFilename( )

Returns the name of the file currently read by the reader

Warning: undefined behaviour if no call to next have been done or if last call to next has returned false

  • Return: Name of the current file

Overridden in child classes as:

File_Archive_Reader_Memory::getFilename()
File_Archive_Reader_File::getFilename()
File_Archive_Reader_Cache::getFilename()
File_Archive_Reader_Concat::getFilename()
File_Archive_Reader_Gzip::getFilename()
Return the name of the single file contained in the archive deduced from the name of the archive (the extension is removed)
File_Archive_Reader_Rar::getFilename()
File_Archive_Reader_Tar::getFilename()
File_Archive_Reader_Bzip2::getFilename()
Return the name of the single file contained in the archive deduced from the name of the archive (the extension is removed)
File_Archive_Reader_Zip::getFilename()
File_Archive_Reader_Cab::getFilename()
File_Archive_Reader_Ar::getFilename()
File_Archive_Reader_Relay::getFilename()
File_Archive_Reader_ChangeName::getFilename()
Returns the name of the file currently read by the reader
File_Archive_Reader_Directory::getFilename()

[ Top ]

getMime   [line 168]

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_Memory::getMime()
File_Archive_Reader_File::getMime()
File_Archive_Reader_Cache::getMime()
File_Archive_Reader_Concat::getMime()
File_Archive_Reader_Relay::getMime()
File_Archive_Reader_Directory::getMime()

[ Top ]

getStandardURL   [line 99]

void getStandardURL( string $path)

Returns the standard path

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


Parameters:

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

[ Top ]

getStat   [line 162]

void getStat( )

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

The returned array may be empty, even if readers should try their best to return as many data as possible


Overridden in child classes as:

File_Archive_Reader_Memory::getStat()
File_Archive_Reader_File::getStat()
File_Archive_Reader_Cache::getStat()
File_Archive_Reader_Concat::getStat()
File_Archive_Reader_Rar::getStat()
File_Archive_Reader_Tar::getStat()
File_Archive_Reader_Zip::getStat()
File_Archive_Reader_Cab::getStat()
File_Archive_Reader_Ar::getStat()
File_Archive_Reader_Relay::getStat()
File_Archive_Reader_Directory::getStat()

[ Top ]

makeAppendWriter   [line 366]


makeWriterRemove   [line 391]

void makeWriterRemove( )

Returns a writer that removes the current file

This is a syntaxic sugar for makeWriterRemoveFiles(new File_Archive_Predicate_Current());


[ Top ]

makeWriterRemoveBlocks   [line 421]

void makeWriterRemoveBlocks( array $blocks, [int $seek = 0])

Return a writer that has the same properties as the one returned by makeWriter, but after having removed a block of data from the current file. The writer will append data to the current file no data (other than the block) will be removed

Overridden in child classes as:

File_Archive_Reader_Memory::makeWriterRemoveBlocks()
File_Archive_Reader_File::makeWriterRemoveBlocks()
File_Archive_Reader_Cache::makeWriterRemoveBlocks()
File_Archive_Reader_Gzip::makeWriterRemoveBlocks()
File_Archive_Reader_Tar::makeWriterRemoveBlocks()
File_Archive_Reader_Bzip2::makeWriterRemoveBlocks()
File_Archive_Reader_Zip::makeWriterRemoveBlocks()
File_Archive_Reader_Ar::makeWriterRemoveBlocks()
File_Archive_Reader_Relay::makeWriterRemoveBlocks()
File_Archive_Reader_Directory::makeWriterRemoveBlocks()

Parameters:

int   $seek   —  relative pos of the block
array   $blocks   —  Lengths of the blocks. The first one will be discarded, the second one kept, the third one discarded... If the sum of the blocks is less than the size of the file, the comportment is the same as if a last block was set in the array to reach the size of the file if $length is -1, the file is truncated from the specified pos It is possible to specify blocks of size 0

[ Top ]

makeWriterRemoveFiles   [line 382]

File_Archive_Writer makeWriterRemoveFiles( File_Archive_Predicate $pred)

Return a writer that has the same properties as the one returned by makeAppendWriter, but after having removed all the files that follow a given predicate.

After a call to makeWriterRemoveFiles, $this is closed and should not be used until the returned writer is closed

  • Return: that allows to append files to the archive

Overridden in child classes as:

File_Archive_Reader_Memory::makeWriterRemoveFiles()
File_Archive_Reader_File::makeWriterRemoveFiles()
File_Archive_Reader_Cache::makeWriterRemoveFiles()
File_Archive_Reader_Gzip::makeWriterRemoveFiles()
File_Archive_Reader_Tar::makeWriterRemoveFiles()
File_Archive_Reader_Bzip2::makeWriterRemoveFiles()
File_Archive_Reader_Zip::makeWriterRemoveFiles()
File_Archive_Reader_Ar::makeWriterRemoveFiles()
File_Archive_Reader_Relay::makeWriterRemoveFiles()
File_Archive_Reader_Uncompress::makeWriterRemoveFiles()
File_Archive_Reader_Directory::makeWriterRemoveFiles()

Parameters:

File_Archive_Predicate   $pred   —  the predicate verified by removed files

[ Top ]

next   [line 48]


remove   [line 400]

void remove( )

Removes the current file from the reader

[ Top ]

rewind   [line 221]

the rewind( [int $length = -1])

Move the current position back of a given amount of bytes.

Not all readers may implement this function (a PEAR error will be returned if the reader can't rewind)

  • Return: number of bytes really rewinded (which may be less than $length if the current pos is less than $length

Overridden in child classes as:

File_Archive_Reader_Memory::rewind()
File_Archive_Reader_File::rewind()
File_Archive_Reader_Cache::rewind()
File_Archive_Reader_Concat::rewind()
File_Archive_Reader_Gzip::rewind()
File_Archive_Reader_Rar::rewind()
File_Archive_Reader_Tar::rewind()
File_Archive_Reader_Bzip2::rewind()
File_Archive_Reader_Zip::rewind()
File_Archive_Reader_Cab::rewind()
File_Archive_Reader_Ar::rewind()
File_Archive_Reader_Relay::rewind()
File_Archive_Reader_Directory::rewind()

Parameters:

int   $length   —  number of bytes to seek before the current pos or -1 to move back to the begining of the current file

[ Top ]

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_Cab::select()
File_Archive_Reader_ChangeName::select()
Returns the list of filenames from the current pos to the end of the source
File_Archive_Reader_Uncompress::select()
File_Archive_Reader_Filter::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 249]

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

Sends the current file to the Writer $writer

The data will be sent by chunks of at most $bufferSize bytes If $bufferSize <= 0 (default), the blockSize option is used


Parameters:

   &$writer   — 
   $bufferSize   — 

[ Top ]

skip   [line 201]

void skip( [ $length = -1])

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_Memory::skip()
File_Archive_Reader_File::skip()
File_Archive_Reader_Cache::skip()
File_Archive_Reader_Concat::skip()
File_Archive_Reader_Gzip::skip()
File_Archive_Reader_Rar::skip()
File_Archive_Reader_Tar::skip()
File_Archive_Reader_Zip::skip()
File_Archive_Reader_Cab::skip()
File_Archive_Reader_Ar::skip()
File_Archive_Reader_Relay::skip()
File_Archive_Reader_Directory::skip()

Parameters:

   $length   — 

[ Top ]

tell   [line 229]



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