public function write($data, $eol = false)
    {
        if ($eol) {
            $buffer = $this->_buffer;
            $debug = $this->client_debug;
            $this->_buffer = '';

            $this->client_debug = true;

            if (fwrite($this->_stream, $buffer . $data . ($eol ? "\r\n" : '')) === false) {
                throw new Horde_Imap_Client_Exception(
                    Horde_Imap_Client_Translation::r("Server write error."),
                    Horde_Imap_Client_Exception::SERVER_WRITEERROR
                );
            }

            if ($debug) {
                $this->_params['debug']->client($buffer . $data);
            }
        } else {
            $this->_buffer .= $data;
        }
    }