Class Reader

Description

The Reader class encapsulates a file. It is hence responsible of upkeeping the connection to the file, keeping track of the cursor position and reading data from it.

Located in /Reader.php (line 55)


	
			
Method Summary
Reader __construct (string $filename, [string $mode = "rb"])
void __destruct ()
boolean available ()
integer getOffset ()
integer getSize ()
string read (integer $length)
void setOffset (integer $offset)
void skip (integer $size)
mixed __call (string $method, string $params)
mixed __get (string $name)
mixed __set (string $name, string $value)
Methods
Constructor __construct (line 70)

Constructs the Reader class with given file.

  • throws: Reader_Exception if the file cannot be read.
  • access: public
Reader __construct (string $filename, [string $mode = "rb"])
  • string $filename: The path to the file.
  • string $mode: The type of access.
Destructor __destruct (line 86)

Closes the file.

  • access: public
void __destruct ()
available (line 98)

Checks whether there is more to be read in the file. Returns true if the end of the file has not yet been reached; false otherwise.

  • access: public
boolean available ()
getOffset (line 140)

Returns the current point of operation.

  • access: public
integer getOffset ()
getSize (line 163)

Returns the file size in bytes.

  • access: public
integer getSize ()
read (line 126)

Reads length amount of bytes from the file stream.

  • throws: Reader_Exception if length attribute is negative.
  • access: public
string read (integer $length)
  • integer $length: The amount of bytes.
setOffset (line 153)

Sets the point of operation, ie the cursor offset value. The offset can also be set to a negative value when it is interpreted as an offset from the end of the file instead of the beginning.

  • access: public
void setOffset (integer $offset)
  • integer $offset: The new point of operation.
skip (line 110)

Jumps size amount of bytes in the file stream.

  • throws: Reader_Exception if size attribute is negative.
  • access: public
void skip (integer $size)
  • integer $size: The amount of bytes.
__call (line 204)

Magic function to delegate the call to helper methods of Transform class to transform read data in another format.

The read data length is determined from the helper method name. For methods where arbitrary data lengths are accepted a parameter can be used to specify the length.

  • throws: Reader_Exception if no such transformer is implemented
  • access: public
mixed __call (string $method, string $params)
  • string $method: The method to be called.
  • string $params: The parameters should the function accept them.
__get (line 171)

Magic function so that $obj->value will work.

  • access: public
mixed __get (string $name)
  • string $name: The field name.
__set (line 184)

Magic function so that assignments with $obj->value will work.

  • access: public
mixed __set (string $name, string $value)
  • string $name: The field name.
  • string $value: The field value.

Documentation generated on Fri, 05 Sep 2008 20:19:17 +0300 by phpDocumentor 1.4.1