TYPO3  7.6
Public Member Functions | List of all members
StreamInterface Interface Reference
Inheritance diagram for StreamInterface:
Stream

Public Member Functions

 __toString ()
 
 close ()
 
 detach ()
 
 getSize ()
 
 tell ()
 
 eof ()
 
 isSeekable ()
 
 seek ($offset, $whence=SEEK_SET)
 
 rewind ()
 
 isWritable ()
 
 write ($string)
 
 isReadable ()
 
 read ($length)
 
 getContents ()
 
 getMetadata ($key=null)
 

Detailed Description

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.

Definition at line 12 of file StreamInterface.php.

Member Function Documentation

__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 Also
http://php.net/manual/en/language.oop5.magic.php#object.tostring
Returns
string

Implemented in Stream.

close ( )

Closes the stream and any underlying resources.

Returns
void

Implemented in Stream.

detach ( )

Separates any underlying resources from the stream.

After the stream has been detached, the stream is in an unusable state.

Returns
resource|null Underlying PHP stream, if any

Implemented in Stream.

eof ( )

Returns true if the stream is at the end of the stream.

Returns
bool

Implemented in Stream.

getContents ( )

Returns the remaining contents in a string

Returns
string
Exceptions
\RuntimeExceptionif unable to read or an error occurs while reading.

Implemented in Stream.

getMetadata (   $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.

string $key Specific metadata to retrieve. array|mixed|null Returns an associative array if no key is provided. Returns a specific key value if a key is provided and the value is found, or null if the key is not found.

Implemented in Stream.

getSize ( )

Get the size of the stream if known.

Returns
int|null Returns the size in bytes if known, or null if unknown.

Implemented in Stream.

isReadable ( )

Returns whether or not the stream is readable.

Returns
bool

Implemented in Stream.

isSeekable ( )

Returns whether or not the stream is seekable.

Returns
bool

Implemented in Stream.

isWritable ( )

Returns whether or not the stream is writable.

Returns
bool

Implemented in Stream.

read (   $length)

Read data from the stream.

Parameters
int$lengthRead up to $length bytes from the object and return them. Fewer than $length bytes may be returned if underlying stream call returns fewer bytes.
Returns
string Returns the data read from the stream, or an empty string if no bytes are available.
Exceptions
\RuntimeExceptionif an error occurs.

Implemented in Stream.

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 Also
seek() on failure.

Implemented in Stream.

seek (   $offset,
  $whence = SEEK_SET 
)
tell ( )

Returns the current position of the file read/write pointer

Returns
int Position of the file pointer
Exceptions
\RuntimeExceptionon error.

Implemented in Stream.

write (   $string)

Write data to the stream.

Parameters
string$stringThe string that is to be written.
Returns
int Returns the number of bytes written to the stream.
Exceptions
\RuntimeExceptionon failure.

Implemented in Stream.