Phalcon\Db\Adapter\MongoDB\GridFS\WritableStream::close PHP Method

close() public method

Closes an active stream and flushes all buffered data to GridFS.
public close ( )
    public function close()
    {
        if ($this->isClosed) {
            // TODO: Should this be an error condition? e.g. BadMethodCallException
            return;
        }
        rewind($this->buffer);
        $cached = stream_get_contents($this->buffer);
        if (strlen($cached) > 0) {
            $this->insertChunk($cached);
        }
        fclose($this->buffer);
        $this->fileCollectionInsert();
        $this->isClosed = true;
    }