Class inputfile

Description

The inputfile class manages files for input. It opens, reads and closes files in input-only mode.

Located in /file-defs.php (line 169)


	
			
Direct descendents
Class Description
 class csv_inputfile CSV Inputfile class Manage CSV-formatted files for input.
 class stylesheet Open a file which contains a stylesheet and read in the style settings. This is a special case of inputfile.
 class quickfile_read This is a derived class from inputfile and is a quick way of grabbing all content of a file in a single hit. The resulting string is available as the class 'content' variable, and the variable 'readok' indicates whether the read was a success. File is read, then immediately closed.
Variable Summary
 mixed $content
 mixed $datafname
 mixed $dir
 mixed $filesize
 mixed $fp
 mixed $name
 mixed $opened
Method Summary
 boolean inputfile (string $name, [string $dir = ""])
 void closefile ()
 boolean eof ()
 boolean openfile ([string $path = ""])
 boolean readall ()
 mixed readln ([integer $maxchars = 4096])
Variables
mixed $content = "" (line 182)

Content of file after readall()

mixed $datafname = "" (line 176)

The full path to the file

mixed $dir = "" (line 174)

The directory prefix (if any) of the file

mixed $filesize = 0 (line 180)

Size of opened file in bytes

mixed $fp (line 186)

The file pointer

mixed $name = "" (line 172)

The file name

mixed $opened = false (line 178)

True if file was opened

Methods
Constructor inputfile (line 195)

Constructor Open the given file for input.

  • return: True if file was opened, else false
boolean inputfile (string $name, [string $dir = ""])
  • string $name: The name of the file
  • string $dir: The directory the file is in
closefile (line 276)

Close the file

void closefile ()
eof (line 243)

Return true if at end-of-file or not opened, else false.

  • return: True if we are at End Of File
boolean eof ()
openfile (line 257)

Open a new file, or the default file as defined by the path in the class variable 'datafname'. If $path is defined then this becomes the new default file.

  • return: True if file was opened ok.
boolean openfile ([string $path = ""])
  • string $path: Path to file, blank means open default file.
readall (line 217)

Reads all of the file contents into class variable $content.

  • return: True if the content was successfully read
boolean readall ()
readln (line 232)

Reads the next line of the file, up to max chars specified.

  • return: A string containing the line, or false if failed
mixed readln ([integer $maxchars = 4096])
  • integer $maxchars: Maximum chars per line to read

Redefined in descendants as:
  • csv_inputfile::readln() : Reads the next line of the file in the form of an array of fields as delimited by the given charater. Lines can be of a length up to the specified maximum no. of chars.

Documentation generated by phpDocumentor 1.3.0RC3