lithium\net\socket\Stream::read()

public method

Reads data from the stream resource

Parameters

  • integer $length

    If specified, will read up to $length bytes from the stream. If no value is specified, all remaining bytes in the buffer will be read.

  • integer $offset

    Seek to the specified byte offset before reading.

Returns

string

Returns string read from stream resource on success, false otherwise.

Source

	public function read($length = null, $offset = null) {
		if (!is_resource($this->_resource)) {
			return false;
		}
		if (!$length) {
			return stream_get_contents($this->_resource);
		}
		return stream_get_contents($this->_resource, $length, $offset);
	}