# system/io/FileReader.php

## \FileReader
jump to top

Package: phing\system\io

Convenience class for reading files.

Unlike the Java counterpart, this class does not (yet) handle character set transformations. This will be an important function of this class with move to supporting PHP6.

Parent(s)
  \InputStreamReader < \Reader
Author
  Hans Lellelid
Author
  Yannick Lecaillez
Version
  $Revision: 552 $

### Properties

`\InputStream $inStream= ''`
inherited

Inherited from: \InputStreamReader::$inStream
Details

Type
  \InputStream
Inherited_from
  \InputStreamReader::$inStream

### Methods

`__construct( mixed $file ) : void`

Construct a new FileReader.

Parameters

Name | Type | Description
--- | --- | ---
$file | mixed | PhingFile or string pathname.

`close( ) : void`
inherited

Close the stream.

Inherited from: \InputStreamReader::close()
Throws

Exception | Description
--- | ---
\IOException | if there is an error closing stream

`eof( ) : boolean`
inherited

Whether eof has been reached with stream.

Inherited from: \InputStreamReader::eof()
Returns

Type | Description
--- | ---
boolean |

`getResource( ) : string`
inherited

Returns string representation of attached stream.

Inherited from: \InputStreamReader::getResource()

This is critical for, e.g., ExpatParser's ability to know the filename that is throwing an ExpatParserException, etc.

Returns

Type | Description
--- | ---
string |

`mark( ) : void`
inherited

Marks the current position in this input stream.

Inherited from: \InputStreamReader::mark()

A subsequent call to reset() will move stream position back to last marker (if supported).

Throws

Exception | Description
--- | ---
\IOException | - if the underlying stream doesn't support this method.

`markSupported( ) : boolean`
inherited

Whether the attached stream supports mark/reset.

Inherited from: \InputStreamReader::markSupported()
Returns

Type | Description
--- | ---
boolean |

`read( int $len = null ) : string`
inherited

Read data from file.

Inherited from: \InputStreamReader::read()

If length is specified, then only that number of chars is read, otherwise stream is read until EOF.

Parameters

Name | Type | Description
--- | --- | ---
$len | int | Num chars to read.

Returns

Type | Description
--- | ---
string | chars read or -1 if eof.

`readInto( $rBuffer ) : TRUE`
inherited

Reads a entire file and stores the data in the variable passed by reference.

Inherited from: \InputStreamReader::readInto()
Parameters

Name | Type | Description
--- | --- | ---
$rBuffer |  |

Returns

Type | Description
--- | ---
TRUE | on success. Err object on failure.

Details

Author
  Charlie Killian, charlie@tizac.com
Deprecated
  Use read() or BufferedReader instead.

`ready( ) : boolean`
inherited

Is stream ready for reading.

Inherited from: \Reader::ready()
Returns

Type | Description
--- | ---
boolean |

`reset( ) : void`
inherited

Repositions this stream to the position at the time the mark method was last called on this input stream.

Inherited from: \InputStreamReader::reset()
Throws

Exception | Description
--- | ---
\IOException | - if the underlying stream doesn't support this method.

`skip( int $n ) : void`
inherited

Skip over $n bytes.

Inherited from: \InputStreamReader::skip()
Parameters

Name | Type | Description
--- | --- | ---
$n | int |

Documentation was generated by DocBlox 0.15.1.