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

Class: File

Source Location: /File-1.4.1/File.php

Class Overview

PEAR
   |
   --File

Class for handling files


Author(s):

Methods


Inherited Variables

Inherited Methods


Class Details

[line 91]
Class for handling files

A class with common functions for writing, reading and handling files and directories



[ Top ]


Method Detail

buildPath   [line 480]

void buildPath( $parts, [ $separator = DIRECTORY_SEPARATOR])

  • Deprecated: Use File_Util::buildPath() instead.

Parameters:

   $parts   — 
   $separator   — 

[ Top ]

close   [line 406]

mixed close( string $filename, string $mode)

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

Parameters:

string   $filename   —  The filename that was opened
string   $mode   —  Mode the file was opened in

[ Top ]

closeAll   [line 375]

void closeAll( )

Closes all open file pointers
  • Access: public

[ Top ]

getTempDir   [line 498]

void getTempDir( )

  • Deprecated: Use File_Util::tmpDir() instead.

[ Top ]

getTempFile   [line 507]

void getTempFile( [ $dirname = null])

  • Deprecated: Use File_Util::tmpFile() instead.

Parameters:

   $dirname   — 

[ Top ]

isAbsolute   [line 516]

void isAbsolute( $path)

  • Deprecated: Use File_Util::isAbsolute() instead.

Parameters:

   $path   — 

[ Top ]

read   [line 205]

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

Returns a specified number of bytes of a file.

Defaults to FILE_DEFAULT_READSIZE. If $size is 0, all file will be read.

  • 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
integer   $size   —  Bytes to read
mixed   $lock   —  Type of lock to use

[ Top ]

readAll   [line 186]

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

Reads an entire file and returns it.

Uses file_get_contents if available.

  • 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 261]

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

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

Returns a line of the file (without trailing CRLF).

Maximum read line length is FILE_MAX_LINE_READSIZE.

  • 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   —  Whether file should be locked

[ Top ]

realpath   [line 534]

void realpath( $path, [ $separator = DIRECTORY_SEPARATOR])

  • Deprecated: Use File_Util::realpath() instead.

Parameters:

   $path   — 
   $separator   — 

[ Top ]

relativePath   [line 525]

void relativePath( $path, $root, [ $separator = DIRECTORY_SEPARATOR])

  • Deprecated: Use File_Util::relativePath() instead.

Parameters:

   $path   — 
   $root   — 
   $separator   — 

[ Top ]

rewind   [line 355]

mixed rewind( string $filename, string $mode)

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

Parameters:

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

[ Top ]

skipRoot   [line 489]

void skipRoot( $path)

  • Deprecated: Use File_Util::skipRoot() instead.

Parameters:

   $path   — 

[ Top ]

stripLeadingSeparators   [line 469]

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

  • Deprecated:

Parameters:

   $path   — 
   $separator   — 

[ Top ]

stripTrailingSeparators   [line 458]

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

  • Deprecated:

Parameters:

   $path   — 
   $separator   — 

[ Top ]

unlock   [line 441]

mixed unlock( string $filename, string $mode)

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

Parameters:

string   $filename   —  The filename that was opened
string   $mode   —  Mode the file was opened in

[ Top ]

write   [line 239]

mixed write( string $filename, string $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
string   $data   —  Data to write to file
string   $mode   —  Mode to open file in
mixed   $lock   —  Type of lock to use

[ Top ]

writeChar   [line 276]

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

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
mixed   $lock   —  Whether to lock the file

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:48:07 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.