# system/io/FileInputStream.php

## \FileInputStream
jump to top

Package: phing\system\io

Input stream subclass for file streams.

Parent(s)
  \InputStream

### Properties

`int $currentPosition= '0'`
inherited

Position of stream cursor.Inherited from: \InputStream::$currentPosition
Default value `0` Details

Type
  int
Inherited_from
  \InputStream::$currentPosition

`\PhingFile $file= ''`

The associated file.

Details

Type
  \PhingFile

`int $mark= '0'`
inherited

Marked position of stream cursor.Inherited from: \InputStream::$mark
Default value `0` Details

Type
  int
Inherited_from
  \InputStream::$mark

`resource $stream= ''`
inherited

The attached PHP stream.Inherited from: \InputStream::$stream
Details

Type
  resource
Inherited_from
  \InputStream::$stream

### Methods

`__construct( \PhingFile|string $file, boolean $append = false ) : void`

Construct a new FileInputStream.

Parameters

Name | Type | Description
--- | --- | ---
$file | \PhingFile|string | Path to the file
$append | boolean | Whether to append (ignored)

Throws

Exception | Description
--- | ---
\Exception | - if invalid argument specified.
\IOException | - if unable to open file.

`__toString( ) : string`

Returns a string representation of the attached file.

Returns

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

`close( ) : void`
inherited

Closes stream.

Inherited from: \InputStream::close()
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`
inherited

Whether eof has been reached with stream.

Inherited from: \InputStream::eof()
Returns

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

`mark( ) : void`
inherited

Marks the current position in this input stream.

Inherited from: \InputStream::mark()
Throws

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

`markSupported( ) : boolean`

Mark is supported by FileInputStream.

Returns

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

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

Read data from stream until $len chars or EOF.

Inherited from: \InputStream::read()
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`
inherited

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

Inherited from: \InputStream::readInto()
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`
inherited

Repositions this stream to the position at the time the mark method was last called on this input stream.

Inherited from: \InputStream::reset()
Throws

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

`skip( int $n ) : void`
inherited

Skip over $n bytes.

Inherited from: \InputStream::skip()
Parameters

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

Documentation was generated by DocBlox 0.15.1.