system/io/InputStream.php
Wrapper class for PHP stream that supports read operations.
- Package
- phing.system.io
\InputStream
Package: phing\system\io
Wrapper class for PHP stream that supports read operations.
- Children
- \FileInputStream
Properties
Methods

__construct(
resource $stream
)
:
voidConstruct a new InputStream.
Parameters
| Name | Type | Description |
|---|---|---|
| $stream | resource | Configured PHP stream for writing. |

__toString(
)
:
stringReturns string representation of attached stream.
Returns
| Type | Description |
|---|---|
| string |

close(
)
:
voidCloses stream.
Throws
| Exception | Description |
|---|---|
| \IOException | if stream cannot be closed (note that calling close() on an already-closed stream will not raise an exception) |

mark(
)
:
voidMarks the current position in this input stream.
Throws
| Exception | Description |
|---|---|
| \IOException | - if the underlying stream doesn't support this method. |

markSupported(
)
:
booleanWhether the input stream supports mark and reset methods.
Returns
| Type | Description |
|---|---|
| boolean |

read(
int $len
=
null
)
:
stringRead data from stream until $len chars or EOF.
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $len | int | Num chars to read. If not specified this stream will read until EOF. |
| Type | Description |
|---|---|
| string | chars read or -1 if eof. |

readInto(
string $rBuffer
)
:
TRUEReads a entire until EOF and places contents in passed-in variable. Stream is closed after read.
Parameters
Returns
Throws
Details
| Name | Type | Description |
|---|---|---|
| $rBuffer | string | &$rBuffer String variable where read contents will be put. |
| Type | Description |
|---|---|
| TRUE | on success. |
| Exception | Description |
|---|---|
| \IOException | - if there is an error reading from stream. |
- Author
- Charlie Killian, charlie@tizac.com
- Deprecated
- - Instead, use the read() method or a BufferedReader.

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