Class FSTools_File

InheritanceFSTools_File

Represents a file in the filesystem

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$fs Instance of FSTools for interfacing with filesystem FSTools_File
$handle Handle for the file FSTools_File
$name Filename of file this object represents FSTools_File

Public Methods

Hide inherited methods

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

Property Details

$fs protected property
protected $fs null
$handle protected property
protected $handle false
$name protected property
protected $name null

Method Details

__construct() public method

Filename of file you wish to instantiate.

public void __construct ( $name, $fs false )
$name
$fs
__destruct() public method

public void __destruct ( )
chmod() public method

Chmod a file

public void chmod ( $octal_code )
$octal_code
close() public method

Closes file's handle

public void close ( )
delete() public method

Deletes the file

public void delete ( )
eof() public method

Returns TRUE if the end of the file has been reached

public void eof ( )
exists() public method

Returns true if file exists and is a file.

public void exists ( )
get() public method

Retrieves the contents of a file

public void get ( )
getChar() public method

Retrieves a character from an open file

public void getChar ( )
getDirectory() public method

Returns directory of the file without trailing slash

public void getDirectory ( )
getLine() public method

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

public void getLine ( $length null )
$length
getMTime() public method

Returns last file modification time

public void getMTime ( )
getName() public method

Returns the filename of the file.

public void getName ( )
open() public method

Opens file's handle

public void open ( $mode )
$mode
put() public method

Writes to an open file

public void put ( $string )
$string
read() public method

Retrieves an $length bytes of data from an open data

public void read ( $length )
$length
write() public method

Writes contents to a file, creates new file if necessary

public void write ( $contents )
$contents