# system/io/InputStream.php

Wrapper class for PHP stream that supports read operations.

Package
  phing.system.io

## \InputStream
jump to top

Package: phing\system\io

Wrapper class for PHP stream that supports read operations.

Children
  \FileInputStream

### Properties

`int $currentPosition= '0'`

Position of stream cursor.
Default value `0` Details

Type
  int

`int $mark= '0'`

Marked position of stream cursor.
Default value `0` Details

Type
  int

`resource $stream= ''`

The attached PHP stream.
Details

Type
  resource

### Methods

`__construct( resource $stream ) : void`

Construct a new InputStream.

Parameters

Name | Type | Description
--- | --- | ---
$stream | resource | Configured PHP stream for writing.

`__toString( ) : string`

Returns string representation of attached stream.

Returns

Type | Description
--- | ---
string |

`close( ) : void`

Closes stream.

Throws

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

`eof( ) : boolean`

Whether eof has been reached with stream.

Returns

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

`mark( ) : void`

Marks the current position in this input stream.

Throws

Exception | Description
--- | ---
\IOException | - if the underlying stream doesn't support this method.

`markSupported( ) : boolean`

Whether the input stream supports mark and reset methods.

Returns

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

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

Read data from stream until $len chars or EOF.

Parameters

Name | Type | Description
--- | --- | ---
$len | int | Num chars to read. If not specified this stream will read until EOF.

Returns

Type | Description
--- | ---
string | chars read or -1 if eof.

`readInto( string $rBuffer ) : TRUE`

Reads a entire until EOF and places contents in passed-in variable. Stream is closed after read.

Parameters

Name | Type | Description
--- | --- | ---
$rBuffer | string | &$rBuffer String variable where read contents will be put.

Returns

Type | Description
--- | ---
TRUE | on success.

Throws

Exception | Description
--- | ---
\IOException | - if there is an error reading from stream.

Details

Author
  Charlie Killian, charlie@tizac.com
Deprecated
  - Instead, use the read() method or a BufferedReader.

`reset( ) : void`

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

`skip( int $n ) : void`

Skip over $n bytes.

Parameters

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

Documentation was generated by DocBlox 0.15.1.