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

Class: File

Source Location: /File-0.9.2/File.php

Class Overview

PEAR
   |
   --File



Methods


Inherited Variables

Inherited Methods


Class Details

[line 81]


[ Top ]


Method Detail

buildPath   [line 383]

void buildPath( array $parts, [mixed $separator = DIRECTORY_SEPARATOR], string $seperator)

Returns a string path built from the array $pathParts. Where a join occurs multiple separators are removed. Joins using the optional separator, defaulting to the PHP DIRECTORY_SEPARATOR constant.
  • Access: public

Parameters:

array   $parts     Array containing the parts to be joined
string   $seperator     The system directory seperator

[ Top ]

close   [line 347]

mixed close( $filename $filename, $mode $mode)

This closes an open file pointer
  • Return: PEAR Error on error, true otherwise

Parameters:

$filename   $filename     The filename that was opened
$mode   $mode     The mode the file was opened in

[ Top ]

getTempDir   [line 465]

string getTempDir( )

Returns the temp directory according to either the TMP, TMPDIR, or TEMP env variables. If these are not set it will also check for the existence of /tmp, %WINDIR%\temp
  • Return: The system tmp directory
  • Access: public

[ Top ]

getTempFile   [line 477]

void getTempFile( [mixed $dirname = null])


[ Top ]

isAbsolute   [line 492]

boolean isAbsolute( string $path)

Returns boolean based on whether given path is absolute or not.
  • Return: True if the path is absolute, false if it is not
  • Access: public

Parameters:

string   $path     Given path

[ Top ]

read   [line 189]

mixed read( string $filename, [int $size = FILE_DEFAULT_READSIZE], [mixed $lock = false])

Returns a specified number of bytes of a file. Defaults to 1024.
  • Return: PEAR_Error on error or a string which contains the data read Will also return false upon EOF
  • Access: public

Parameters:

string   $filename     Name of file to read from
int   $size     Bytes to read
mixed   $lock     Type of lock to use

[ Top ]

readAll   [line 166]

mixed readAll( string $filename, [mixed $lock = false])

Reads an entire file and returns it.
  • Return: PEAR_Error if an error has occured or a string with the contents of the the file
  • Access: public

Parameters:

string   $filename     Name of file to read from
mixed   $lock     Type of lock to use

[ Top ]

readChar   [line 242]

mixed readChar( string $filename, [mixed $lock = false])

Reads and returns a single character from given filename
  • Return: PEAR_Error on error or one character of the specified file
  • Access: public

Parameters:

string   $filename     Name of file to read from
mixed   $lock     Type of lock to use

[ Top ]

readLine   [line 278]

mixed readLine( string $filename, [boolean $lock = false])

Returns a line of the file
  • Return: PEAR_Error on error or a string containing the line read from file
  • Access: public

Parameters:

string   $filename     Name of file to read from
boolean   $lock     Type of lock to use

[ Top ]

rewind   [line 331]

mixed rewind( $filename $filename, $mode $mode)

This rewinds a filepointer to the start of a file
  • Return: PEAR Error on error, true on success

Parameters:

$filename   $filename     The filename
$mode   $mode     Mode the file was opened in

[ Top ]

skipRoot   [line 443]

string skipRoot( string $path)

Returns a path without leading / or C:\. If this is not present the path is returned as is.
  • Return: The processed path or the path as is
  • Access: public

Parameters:

string   $path     The path to be processed

[ Top ]

stripLeadingSeparators   [line 426]

string stripLeadingSeparators( string $path, [string $separator = DIRECTORY_SEPARATOR])

Strips leading separators from the given path
  • Return: Resulting path
  • Access: public

Parameters:

string   $path     Path to use
string   $separator     Separator to look for

[ Top ]

stripTrailingSeparators   [line 409]

string stripTrailingSeparators( string $path, [string $separator = DIRECTORY_SEPARATOR])

Strips trailing separators from the given path
  • Return: Resulting path
  • Access: public

Parameters:

string   $path     Path to use
string   $separator     Separator to look for

[ Top ]

unlock   [line 365]

mixed unlock( $filename 0, $mode 1)

This unlocks a locked file pointer.
  • Return: PEAR Error on error, true otherwise

Parameters:

$filename   0     The filename that was opened
$mode   1     The mode the file was opened in

[ Top ]

write   [line 221]

mixed write( string $filename, int $data, [string $mode = FILE_MODE_APPEND], [mixed $lock = false])

Writes the given data to the given filename. Defaults to no lock, append mode.
  • Return: PEAR_Error on error or number of bytes written to file.
  • Access: public

Parameters:

string   $filename     Name of file to write to
int   $data     Data to write to file
string   $mode     Mode to open file in
mixed   $lock     Type of lock to use

[ Top ]

writeChar   [line 257]

mixed writeChar( string $filename, string $char, [string $mode = FILE_MODE_APPEND], [mixed $lock = false])

Writes a single character to a file
  • Return: PEAR_Error on error, or 1 on success
  • Access: public

Parameters:

string   $filename     Name of file to write to
string   $char     Character to write
string   $mode     Mode to use when writing
mixed   $lock     Type of lock to use

[ Top ]

writeLine   [line 311]

mixed writeLine( string $filename, string $line, [string $mode = FILE_MODE_APPEND], [string $crlf = "\n"], [mixed $lock = false])

Writes a single line, appending a LF (by default)
  • Return: PEAR_Error on error or number of bytes written to file (including appended crlf)
  • Access: public

Parameters:

string   $filename     Name of file to write to
string   $line     Line of data to be written to file
string   $mode     Write mode, can be either FILE_MODE_WRITE or FILE_MODE_APPEND
string   $crlf     The CRLF your system is using. UNIX = \n Windows = \r\n Mac = \r

[ Top ]


Documentation generated on Sun, 16 May 2004 05:04:58 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.