# system/io/BufferedReader.php

Convenience class for reading files.

Access
  public
Author
  Yannick Lecaillez
Package
  phing.system.io
See
  \FilterReader
Version
  $Revision: 557 $ $Date: 2009-08-29 15:54:38 +0200 (Sat, 29 Aug 2009) $

## \BufferedReader
jump to top

Package: phing\system\io

Convenience class for reading files.

Parent(s)
  \Reader
See
  \FilterReader
Access
  public
Author
  Yannick Lecaillez
Version
  $Revision: 557 $ $Date: 2009-08-29 15:54:38 +0200 (Sat, 29 Aug 2009) $

### Properties

`$buffer= 'null'`
Default value `null` Details

Type

`$bufferPos= '0'`
Default value `0` Details

Type

`$bufferSize= '0'`
Default value `0` Details

Type

`$in= ''`

The Reader we are buffering for.

Details

Type

### Methods

`__construct( object $reader, integer $buffsize = 65536 ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$reader | object | The reader (e.g. FileReader).
$buffsize | integer | The size of the buffer we should use for reading files. A large buffer ensures that most files (all scripts?) are parsed in 1 buffer.

`close( ) : void`

Close stream.

Throws

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

`eof( ) : boolean`

Returns whether eof has been reached in stream.

This is important, because filters may want to know if the end of the file (and not just buffer) has been reached.

Returns

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

`getResource( ) : string`

Returns the filename, url, etc. that is being read from.

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

If supported, places a "marker" (like a bookmark) at current stream position.

Inherited from: \Reader::mark()

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

`markSupported( ) : boolean`
inherited

Whether marking is supported.

Inherited from: \Reader::markSupported()
Returns

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

`open( ) : void`

`read( int $len = null ) : mixed`

Reads and returns a chunk of data.

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

Parameters

Name | Type | Description
--- | --- | ---
$len | int | Number of bytes to read. Default is to read configured buffer size number of bytes.

Returns

Type | Description
--- | ---
mixed | buffer or -1 if EOF.

`readChar( ) : string`

Reads a single char from the reader.

Returns

Type | Description
--- | ---
string | single char or -1 if EOF.

`readLine( ) : void`

Read a line from input stream.

`ready( ) : boolean`
inherited

Is stream ready for reading.

Inherited from: \Reader::ready()
Returns

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

`reset( ) : void`

Reset the current position in stream to beginning or last mark (if supported).

`skip( int $n ) : void`

Move stream position relative to current pos.

Parameters

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

Documentation was generated by DocBlox 0.15.1.