spunQ_GzipFile Class Reference

A class describing a Gzip file. More...

Inheritance diagram for spunQ_GzipFile:

spunQ_File spunQ_FileNode spunQ_IFile spunQ_IFileNode spunQ_IFileNode

List of all members.

Public Member Functions

 readIntoArray ()
 Reads the decompressed content of this gzip file into an array.
 readIntoString ()
 Reads the decompressed content of this gzip file into a string.
 write ($string, $append)
 Compresses the given string and writes it to the current file.
 lock ($timeout=0)
 Tries to lock the file.
 unlock ()
 Unlocks the previously locked file.
 getFolder ()
 Alias for getContainingFolder().
 getExtension ()
 Gets the extension of this file.
 getMimeType ()
 Gets the mime type of a file using the fileinfo module.
 create ()
 Makes sure this file actually exists.
 delete ()
 Deletes this file from the file system.
 rename ($newName, $overwrite)
 Renames the file, but keeps it in the same folder.
 copyTo ($file, $overwrite)
 Copies the contents of this file into another file.
 moveTo ($folder, $overwrite, $newName=NULL)
 Moves this file into another directory (and optionally renames it).
 getFileName ()
 Gets the name of this file, up to the first dot.
 assureExists ()
 Throws an exception if this file does not exist.
 getSize ()
 Gets this file's size in bytes.
 exists ()
 Whether this node already exists in the file system.
 residesIn (spunQ_IFolder $folder)
 Checks whether this file is in given folder or one of its subfolders.
 isReadable ()
 Whether the node is readable.
 getPath ()
 Returns the path pointing to the node.
 getPrettyPath ()
 Returns the most unique and human-readable path.
 getContainingFolder ()
 Returns the folder this node is residing in.
 getName ()
 Returns the name of this node, deprived of its path.
 getLastAccessTime ()
 Returns the time of last access of this node.
 getLastModificationTime ()
 Returns the time of last modification of this node.
 __toString ()
 Returns getPrettyPath().

Static Public Member Functions

static get ($path)
 Factory method.
static current ()
 Provides the spunQ_File object of the file calling this function.
static _init ()
 Initializes the class.
static _shutdown ()
 Deletes all temporary files.
static createTemporaryFile (spunQ_Folder $folder=NULL, $deleteOnShutdown=true)
 Creates a temporary file.
static pathIsAbsolute ($filePath)
 Tests if a givebn file path is absolute or relative.
static prettifyPath ($path)
 Makes transformations to a path string to make it more readable.

Protected Attributes

 $filePointer = NULL
 File pointer acquired through call to fopen().
 $path
 The path pointing to the node.


Detailed Description

A class describing a Gzip file.

Definition at line 6 of file GzipFile.class.php.


Member Function Documentation

spunQ_FileNode::__toString (  )  [inherited]

Returns getPrettyPath().

Returns:
string

Definition at line 162 of file FileNode.class.php.

static spunQ_File::_init (  )  [static, inherited]

Initializes the class.

Just registers a shutdown hook to delete temporary files.

Returns:
void

Definition at line 31 of file File.class.php.

static spunQ_File::_shutdown (  )  [static, inherited]

Deletes all temporary files.

Returns:
void

Definition at line 40 of file File.class.php.

spunQ_File::assureExists (  )  [inherited]

Throws an exception if this file does not exist.

Returns:
spunQ_IFile $this
Exceptions:
spunQ_IOException 

Implements spunQ_IFile.

Definition at line 280 of file File.class.php.

spunQ_File::copyTo ( file,
overwrite 
) [inherited]

Copies the contents of this file into another file.

Parameters:
$file The file to copy to. Either a spunQ_IFile object or a string.
$overwrite Whether the destination file should be overwritten.
Returns:
spunQ_IFile $this

Implements spunQ_IFile.

Definition at line 202 of file File.class.php.

spunQ_File::create (  )  [inherited]

Makes sure this file actually exists.

Doesn't do anything, if the node already exists.

Returns:
spunQ_IFile $this

Implements spunQ_IFile.

Definition at line 173 of file File.class.php.

static spunQ_File::createTemporaryFile ( spunQ_Folder folder = NULL,
deleteOnShutdown = true 
) [static, inherited]

Creates a temporary file.

The file will have a random name and will be deleted when the process finishes.

Parameters:
$folder The folder to create the file in. The system's temporary folder will be used if this parameter is omitted.
$deleteOnShutdown The file will be deleted as soon as the PHP process comes to an end.
Returns:
spunQ_File

Definition at line 67 of file File.class.php.

static spunQ_File::current (  )  [static, inherited]

Provides the spunQ_File object of the file calling this function.

You can use this function to get the file you're currently in, if you want a file relative to that one. Makes use of spunQ_Backtrace.

Returns:
spunQ_File

Definition at line 20 of file File.class.php.

spunQ_File::delete (  )  [inherited]

Deletes this file from the file system.

Returns:
spunQ_IFile $this

Implements spunQ_IFile.

Definition at line 184 of file File.class.php.

spunQ_FileNode::exists (  )  [inherited]

Whether this node already exists in the file system.

It is perfectly valid for an object to describe a non-existent node.

Returns:
bool

Implements spunQ_IFileNode.

Definition at line 78 of file FileNode.class.php.

static spunQ_GzipFile::get ( path  )  [static]

Factory method.

Creates a file object that will operate on the given path.

Parameters:
$path A string describing a path on the file system
Returns:
spunQ_File

Reimplemented from spunQ_File.

Definition at line 14 of file GzipFile.class.php.

spunQ_FileNode::getContainingFolder (  )  [inherited]

Returns the folder this node is residing in.

Returns:
spunQ_IFolder

Implements spunQ_IFileNode.

Definition at line 127 of file FileNode.class.php.

spunQ_File::getExtension (  )  [inherited]

Gets the extension of this file.

Extension is defined as the last part of the file that is seperated by a dot. The extension of the file 'Some.class.php' is 'php'.

Returns:
string

Implements spunQ_IFile.

Definition at line 155 of file File.class.php.

spunQ_File::getFileName (  )  [inherited]

Gets the name of this file, up to the first dot.

The FileName of 'Some.class.php' is 'Some'.

Returns:
string

Implements spunQ_IFile.

Definition at line 273 of file File.class.php.

spunQ_File::getFolder (  )  [inherited]

Alias for getContainingFolder().

Returns:
spunQ_IFolder

Implements spunQ_IFile.

Definition at line 148 of file File.class.php.

spunQ_FileNode::getLastAccessTime (  )  [inherited]

Returns the time of last access of this node.

Returns:
int The result is a unix-timestamp
Exceptions:
spunQ_IOException If the timestamp could not be read.

Implements spunQ_IFileNode.

Definition at line 141 of file FileNode.class.php.

spunQ_FileNode::getLastModificationTime (  )  [inherited]

Returns the time of last modification of this node.

Returns:
int The result is a unix-timestamp
Exceptions:
spunQ_IOException If the timestamp could not be read.

Implements spunQ_IFileNode.

Definition at line 151 of file FileNode.class.php.

spunQ_File::getMimeType (  )  [inherited]

Gets the mime type of a file using the fileinfo module.

Returns:
string

Definition at line 163 of file File.class.php.

spunQ_FileNode::getName (  )  [inherited]

Returns the name of this node, deprived of its path.

Returns:
string

Implements spunQ_IFileNode.

Definition at line 134 of file FileNode.class.php.

spunQ_FileNode::getPath (  )  [inherited]

Returns the path pointing to the node.

Returns:
string

Implements spunQ_IFileNode.

Definition at line 102 of file FileNode.class.php.

spunQ_FileNode::getPrettyPath (  )  [inherited]

Returns the most unique and human-readable path.

If the file exists, the builtin function realpath() is used. Otherwise, a better-looking path is achieved through string manipulation, i.e. '../a/../d/./' becomes '../d/'.

Returns:
string

Implements spunQ_IFileNode.

Definition at line 109 of file FileNode.class.php.

spunQ_File::getSize (  )  [inherited]

Gets this file's size in bytes.

Returns:
integer
Exceptions:
spunQ_IOException 

Implements spunQ_IFile.

Definition at line 300 of file File.class.php.

spunQ_FileNode::isReadable (  )  [inherited]

Whether the node is readable.

Returns:
bool

Implements spunQ_IFileNode.

Definition at line 95 of file FileNode.class.php.

spunQ_File::lock ( timeout = 0  )  [inherited]

Tries to lock the file.

Will try to acquire an exclusive write lock to the file. Note that this function will block (as if the $timeout parameter was NULL) regardless of the function parameter on a windows machine due to the implementation of flock().

See also:
http://php.net/flock
Parameters:
$timeout Amount of seconds the function should block until the file is locked. Setting this to NULL will block indefinitely (until max_execution_time runs out). The default value of 0 will not block at all.
Returns:
boolean Whether the file was locked

Definition at line 101 of file File.class.php.

spunQ_File::moveTo ( folder,
overwrite,
newName = NULL 
) [inherited]

Moves this file into another directory (and optionally renames it).

Parameters:
$folder the folder to move to. Either a spunQ_IFolder or a string.
$overwrite Whether the destination file should be overwritten.
$newName The file will be renamed, too if this is set.
Returns:
spunQ_IFile $this

Implements spunQ_IFile.

Definition at line 219 of file File.class.php.

static spunQ_FileNode::pathIsAbsolute ( filePath  )  [static, inherited]

Tests if a givebn file path is absolute or relative.

Parameters:
$filePath The file path - a string.
Returns:
boolean

Definition at line 14 of file FileNode.class.php.

static spunQ_FileNode::prettifyPath ( path  )  [static, inherited]

Makes transformations to a path string to make it more readable.

Removes references to current and upper directories (/foo/.. or foo/.), for example. Assumes that the path has a slash as delimiter. if you want to use this function on a windows path, make sure to replace backslashes by forward slashes beforehand.

Parameters:
$path The path string to transform.
Returns:
string

Definition at line 34 of file FileNode.class.php.

spunQ_File::rename ( newName,
overwrite 
) [inherited]

Renames the file, but keeps it in the same folder.

Use moveTo() if you want to rename and move.

Parameters:
$newName The new name of the file.
$overwrite Whether the destination file should be overwritten.
Returns:
spunQ_IFile $this

Implements spunQ_IFile.

Definition at line 195 of file File.class.php.

spunQ_FileNode::residesIn ( spunQ_IFolder folder  )  [inherited]

Checks whether this file is in given folder or one of its subfolders.

Parameters:
$folder The folder to test against.
Returns:
bool

Implements spunQ_IFileNode.

Definition at line 85 of file FileNode.class.php.

spunQ_File::unlock (  )  [inherited]

Unlocks the previously locked file.

Returns:
spunQ_File $this

Definition at line 137 of file File.class.php.


Member Data Documentation

spunQ_File::$filePointer = NULL [protected, inherited]

File pointer acquired through call to fopen().

The file pointer is current only used when locking the file through flock()! I repeat: it is not used for reading/writing data, merely for locking the file.

Type:
resource

Definition at line 86 of file File.class.php.

spunQ_FileNode::$path [protected, inherited]

The path pointing to the node.

string

Definition at line 64 of file FileNode.class.php.


The documentation for this class was generated from the following file:

Generated on Fri Jul 1 11:12:40 2011 for spunQ3 by  doxygen 1.5.9