Convenience class for reading files.

author <a href="mailto:yl@seasonfive.com">Yannick Lecaillez</a>
version $Id$
access public
see \global\FilterReader
package phing.system.io

 Methods

__construct()

__construct(\Reader $reader, integer $buffsize) 

Parameters

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

close() 

Exceptions

\IOException if there is an error closing stream

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.

Returns

boolean

Returns the filename, url, etc.

getResource() : string

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

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

inherited_from \Reader::mark()

Whether marking is supported.

markSupported() : boolean
Inherited
inherited_from \Reader::markSupported()

Returns

boolean

open()

open() 

Reads and returns a chunk of data.

read(int $len) : mixed

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

Parameters

$len

int

Number of bytes to read. Default is to read configured buffer size number of bytes.

Returns

mixedbuffer or -1 if EOF.

Reads a single char from the reader.

readChar() : string

Returns

stringsingle char or -1 if EOF.

Read a line from input stream.

readLine() 

Is stream ready for reading.

ready() : boolean
Inherited
inherited_from \Reader::ready()

Returns

boolean

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

reset() 

Move stream position relative to current pos.

skip(int $n) 

Parameters

$n

int

 Properties

 

$buffer 
 

$bufferPos 
 

$bufferSize 
 

$in