StreamInterface

Describes a data stream. Typically, an instance will wrap a PHP stream; this interface provides a wrapper around the most common operations, including serialization of the entire stream to a string.

Known implementers

Sunrise\Stream\Stream

Methods Summary
public
# __toString( )
Reads all data from the stream into a string, from the beginning to end. This method MUST attempt to seek to the beginning of the stream before reading data and read the stream until the end is reached. Warning: This could attempt to load a large amount of data into memory. This method MUST NOT raise an exception in order to conform with PHP's string casting operations.

see

public
# close( )
Closes the stream and any underlying resources.
public
# detach( )
Separates any underlying resources from the stream. After the stream has been detached, the stream is in an unusable state.
public
# getSize( )
Get the size of the stream if known.
public
# tell( )
Returns the current position of the file read/write pointer
public
# eof( )
Returns true if the stream is at the end of the stream.
public
# isSeekable( )
Returns whether or not the stream is seekable.
public
# seek( int $offset , int $whence = NULL )
Seek to a position in the stream.

link

public
# rewind( )
Seek to the beginning of the stream. If the stream is not seekable, this method will raise an exception; otherwise, it will perform a seek(0).

see

seek()

link

public
# isWritable( )
Returns whether or not the stream is writable.
public
# write( string $string )
Write data to the stream.
public
# isReadable( )
Returns whether or not the stream is readable.
public
# read( int $length )
Read data from the stream.
public
# getContents( )
Returns the remaining contents in a string
public
# getMetadata( string $key = NULL )
Get stream metadata as an associative array or retrieve a specific key. The keys returned are identical to the keys returned from PHP's stream_get_meta_data() function.

link