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

Class: File_Archive_Reader

Source Location: /File_Archive-0.1.0/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

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 150]

void close( )

Put back the reader in the state it was before the first call

to next()


Overridden in child classes as:

File_Archive_Reader_Memory::close()
File_Archive_Reader_File::close()

[ Top ]

extract   [line 172]

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

Sends the whole reader to $writer and close the reader

If $autoClose is true (default), $writer will be closed after the extraction Data will be sent to the reader by chunks of at most $bufferSize bytes


Parameters:

   &$writer   — 
   $autoClose   — 
   $bufferSize   — 

[ Top ]

extractFile   [line 199]

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

Extract only one file (given by the URL)

This is like calling select, sendData and (if $autoClose is true) closing the writer


Parameters:

   $filename   — 
   &$writer   — 
   $autoClose   — 
   $bufferSize   — 

[ Top ]

getData   [line 136]

void getData( [ $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_Memory::getData()
File_Archive_Reader_File::getData()

Parameters:

   $length   — 

[ Top ]

getDataFilename   [line 128]

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()

[ Top ]

getFilename   [line 97]

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()

[ Top ]

getMime   [line 114]

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()

[ Top ]

getStandardURL   [line 78]

void getStandardURL( $path)

Returns the standard path

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


Parameters:

   $path   — 

[ Top ]

getStat   [line 108]

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_Memory::getStat()
File_Archive_Reader_File::getStat()

[ Top ]

next   [line 48]

bool next( )

Move to the next file in the reader
  • Return: true iif no more files are available

Overridden in child classes as:

File_Archive_Reader_Memory::next()
The subclass should overwrite this function to change the filename, stat and memory
File_Archive_Reader_File::next()

[ Top ]

select   [line 59]

bool select( string $filename)

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

Parameters:

string   $filename   —  Name of the file to find in the archive

[ Top ]

sendData   [line 156]

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

Sends the current file to the Writer $writer

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


Parameters:

   &$writer   — 
   $bufferSize   — 

[ Top ]

skip   [line 144]

void skip( $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_Memory::skip()
File_Archive_Reader_File::skip()

Parameters:

   $length   — 

[ Top ]


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