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.

public abstract __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
  • return string
public abstract close()

Closes the stream and any underlying resources.

  • return void
public abstract detach()

Separates any underlying resources from the stream.

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

  • return resource|null Underlying PHP stream, if any
public abstract eof()

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

  • return bool
public abstract getContents()

Returns the remaining contents in a string

  • return string
  • throws RuntimeException if unable to read or an error occurs while reading.
public abstract 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.

public abstract getSize()

Get the size of the stream if known.

  • return int|null Returns the size in bytes if known, or null if unknown.
public abstract isReadable()

Returns whether or not the stream is readable.

  • return bool
public abstract isSeekable()

Returns whether or not the stream is seekable.

  • return bool
public abstract isWritable()

Returns whether or not the stream is writable.

  • return bool
public abstract read( $length)

Read data from the stream.

  • return string Returns the data read from the stream, or an empty string if no bytes are available.
  • throws RuntimeException if an error occurs.
public abstract 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).

public abstract seek( $offset, $whence = 0)

Seek to a position in the stream.

public abstract tell()

Returns the current position of the file read/write pointer

  • return int Position of the file pointer
  • throws RuntimeException on error.
public abstract write( $string)

Write data to the stream.

  • return int Returns the number of bytes written to the stream.
  • throws RuntimeException on failure.
© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only