system/io/FileReader.php
Convenience class for reading files.
- Package
- phing.system.io
\FileReader
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
- $Id$
Properties


\InputStream
$inStream= ''
- Type
- \InputStream
- Inherited_from
- \InputStreamReader::$$inStream
Methods


__construct(
mixed $file
)
:
void
Construct a new FileReader.
Name | Type | Description |
---|---|---|
$file | mixed | PhingFile or string pathname. |


getResource(
)
:
string
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.
Type | Description |
---|---|
string |


mark(
)
:
void
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).
Exception | Description |
---|---|
\IOException | - if the underlying stream doesn't support this method. |


markSupported(
)
:
boolean
Whether the attached stream supports mark/reset.
Inherited from: \InputStreamReader::markSupported()Type | Description |
---|---|
boolean |


read(
int $len
=
null
)
:
string
If length is specified, then only that number of chars is read, otherwise stream is read until EOF.
Name | Type | Description |
---|---|---|
$len | int | Num chars to read. |
Type | Description |
---|---|
string | chars read or -1 if eof. |


readInto(
$rBuffer
)
:
TRUE
Reads a entire file and stores the data in the variable passed by reference.
Inherited from: \InputStreamReader::readInto()Name | Type | Description |
---|---|---|
$rBuffer |
Type | Description |
---|---|
TRUE | on success. Err object on failure. |
- Author
- Charlie Killian, charlie@tizac.com


reset(
)
:
void
Repositions this stream to the position at the time the mark method was last called on this input stream.
Inherited from: \InputStreamReader::reset()Exception | Description |
---|---|
\IOException | - if the underlying stream doesn't support this method. |