PHPDaemon\HTTPRequest\Input::readFromBuffer PHP Method

readFromBuffer() public method

Moves $n bytes from input buffer to arbitrary buffer
public readFromBuffer ( EventBuffer $buf ) : integer
$buf EventBuffer Source nuffer
return integer
    public function readFromBuffer(\EventBuffer $buf)
    {
        if (!$this->req) {
            return false;
        }
        $n = min($this->req->attrs->contentLength - $this->readed, $buf->length);
        if ($n > 0) {
            $m = $this->appendFrom($buf, $n);
            $this->readed += $m;
            if ($m > 0) {
                $this->onRead();
            }
        } else {
            $this->onRead();
            return 0;
        }
        return $m;
    }