# system/io/OutputStream.php

Wrapper class for PHP stream that supports write operations.

Package
  phing.system.io

## \OutputStream
jump to top

Package: phing\system\io

Wrapper class for PHP stream that supports write operations.

Children
  \FileOutputStream

### Properties

`resource $stream= ''`

The configured PHP stream.
Details

Type
  resource

### Methods

`__construct( resource $stream ) : void`

Construct a new OutputStream.

Parameters

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

`__toString( ) : string`

Returns a string representation of the attached PHP stream.

Returns

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

`close( ) : void`

Closes attached stream, flushing output first.

Throws

Exception | Description
--- | ---
\IOException | if cannot close stream (note that attempting to close an already closed stream will not raise an IOException)

`flush( ) : void`

Flushes stream.

Throws

Exception | Description
--- | ---
\IOException | if unable to flush data (e.g. stream is not open).

`write( string $buf, int $off = null, int $len = null ) : void`

Writes data to stream.

Parameters

Name | Type | Description
--- | --- | ---
$buf | string | Binary/character data to write.
$off | int | (Optional) offset.
$len | int | (Optional) number of bytes/chars to write.

Throws

Exception | Description
--- | ---
\IOException | - if there is an error writing to stream

Documentation was generated by DocBlox 0.15.1.