HTMLPurifier 4.4.0
FSTools_File Class Reference

Represents a file in the filesystem. More...

List of all members.

Public Member Functions

 __construct ($name, $fs=false)
 Filename of file you wish to instantiate.
 getName ()
 Returns the filename of the file.
 getDirectory ()
 Returns directory of the file without trailing slash.
 get ()
 Retrieves the contents of a file.
 write ($contents)
 Writes contents to a file, creates new file if necessary.
 delete ()
 Deletes the file.
 exists ()
 Returns true if file exists and is a file.
 getMTime ()
 Returns last file modification time.
 chmod ($octal_code)
 Chmod a file.
 open ($mode)
 Opens file's handle.
 close ()
 Closes file's handle.
 getLine ($length=null)
 Retrieves a line from an open file, with optional max length $length.
 getChar ()
 Retrieves a character from an open file.
 read ($length)
 Retrieves an $length bytes of data from an open data.
 put ($string)
 Writes to an open file.
 eof ()
 Returns TRUE if the end of the file has been reached.
 __destruct ()

Protected Attributes

 $name
 Filename of file this object represents.
 $handle = false
 Handle for the file.
 $fs
 Instance of FSTools for interfacing with filesystem.

Detailed Description

Represents a file in the filesystem.

Warning:
Be sure to distinguish between get() and write() versus read() and put(), the former operates on the entire file, while the latter operates on a handle.

Definition at line 10 of file File.php.


Constructor & Destructor Documentation

FSTools_File::__construct ( name,
fs = false 
)

Filename of file you wish to instantiate.

Note:
This file need not exist

Definition at line 26 of file File.php.

References $fs, $name, and FSTools::singleton().

FSTools_File::__destruct ( )

Definition at line 120 of file File.php.

References close().


Member Function Documentation

FSTools_File::chmod ( octal_code)

Chmod a file.

Note:
We ignore errors because of some weird owner trickery due to SVN duality

Definition at line 70 of file File.php.

FSTools_File::close ( )

Closes file's handle.

Definition at line 82 of file File.php.

Referenced by __destruct(), and open().

FSTools_File::delete ( )

Deletes the file.

Definition at line 51 of file File.php.

FSTools_File::eof ( )

Returns TRUE if the end of the file has been reached.

Definition at line 115 of file File.php.

FSTools_File::exists ( )

Returns true if file exists and is a file.

Definition at line 56 of file File.php.

FSTools_File::get ( )

Retrieves the contents of a file.

Todo:
Throw an exception if file doesn't exist

Definition at line 41 of file File.php.

FSTools_File::getChar ( )

Retrieves a character from an open file.

Definition at line 97 of file File.php.

References open().

FSTools_File::getDirectory ( )

Returns directory of the file without trailing slash.

Definition at line 35 of file File.php.

FSTools_File::getLine ( length = null)

Retrieves a line from an open file, with optional max length $length.

Definition at line 90 of file File.php.

References open().

FSTools_File::getMTime ( )

Returns last file modification time.

Definition at line 61 of file File.php.

FSTools_File::getName ( )

Returns the filename of the file.

Definition at line 32 of file File.php.

FSTools_File::open ( mode)

Opens file's handle.

Definition at line 75 of file File.php.

References close().

Referenced by getChar(), getLine(), put(), and read().

FSTools_File::put ( string)

Writes to an open file.

Definition at line 109 of file File.php.

References open().

FSTools_File::read ( length)

Retrieves an $length bytes of data from an open data.

Definition at line 103 of file File.php.

References open().

FSTools_File::write ( contents)

Writes contents to a file, creates new file if necessary.

Definition at line 46 of file File.php.


Member Data Documentation

FSTools_File::$fs [protected]

Instance of FSTools for interfacing with filesystem.

Definition at line 20 of file File.php.

Referenced by __construct().

FSTools_File::$handle = false [protected]

Handle for the file.

Definition at line 17 of file File.php.

FSTools_File::$name [protected]

Filename of file this object represents.

Definition at line 14 of file File.php.

Referenced by __construct().


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