BufferedReader

Extends \Reader

Convenience class for reading files.

author

Yannick Lecaillez

version

$Id$

access

public

see
package

phing.system.io

Methods

__construct

__construct(object $reader, integer $buffsize = 65536) 

Arguments

$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.

Read data from source.

read(int $len = null) 
inherited abstract

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

Arguments

$len

int

Move stream position relative to current pos.

skip(int $n) 
inherited

Arguments

$n

int

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

reset() 
inherited

Close stream.

close() 
inherited abstract
throws

if there is an error closing stream

open

open() 

Read a line from input stream.

readLine() 

Reads a single char from the reader.

readChar() : string

Response

string

single char or -1 if EOF.

Returns whether eof has been reached in stream.

eof() : boolean

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

Response

boolean

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

getResource() : string
inherited abstract

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

Response

string

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

mark() 
inherited

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

Whether marking is supported.

markSupported() : boolean
inherited

Response

boolean

Is stream ready for reading.

ready() : boolean
inherited

Response

boolean

Properties

bufferSize

bufferSize : 

buffer

buffer : 

bufferPos

bufferPos : 

The Reader we are buffering for.

in :