original_string: public function writeLiteral($data, $length, $binary = false)
      {
          $this->_buffer = '';
          $success = false;
  
          if ($data instanceof Horde_Stream) {
              $data = $data->stream;
          }
  
          if (rewind($data)) {
              $success = true;
              while (!feof($data)) {
                  if ((($read_data = fread($data, 8192)) === false) ||
                      (fwrite($this->_stream, $read_data) === false)) {
                      $success = false;
                      break;
                  }
              }
          }
  
          if (!$success) {
              $this->client_debug = true;
              throw new Horde_Imap_Client_Exception(
                  Horde_Imap_Client_Translation::r("Server write error."),
                  Horde_Imap_Client_Exception::SERVER_WRITEERROR
              );
          }
  
          if ($this->client_debug && !empty($this->_params['debugliteral'])) {
              rewind($data);
              while (!feof($data)) {
                  $this->_params['debug']->raw(fread($data, 8192));
              }
          } else {
              $this->_params['debug']->client('[' . ($binary ? 'BINARY' : 'LITERAL') . ' DATA: ' . $length . ' bytes]');
          }
      }
code: public function writeLiteral($data, $length, $binary = false)
      {
          $this->_buffer = '';
          $success = false;
  
          if ($data instanceof Horde_Stream) {
              $data = $data->stream;
          }
  
          if (rewind($data)) {
              $success = true;
              while (!feof($data)) {
                  if ((($read_data = fread($data, 8192)) === false) ||
                      (fwrite($this->_stream, $read_data) === false)) {
                      $success = false;
                      break;
                  }
              }
          }
  
          if (!$success) {
              $this->client_debug = true;
              throw new Horde_Imap_Client_Exception(
                  Horde_Imap_Client_Translation::r("Server write error."),
                  Horde_Imap_Client_Exception::SERVER_WRITEERROR
              );
          }
  
          if ($this->client_debug && !empty($this->_params['debugliteral'])) {
              rewind($data);
              while (!feof($data)) {
                  $this->_params['debug']->raw(fread($data, 8192));
              }
          } else {
              $this->_params['debug']->client('[' . ($binary ? 'BINARY' : 'LITERAL') . ' DATA: ' . $length . ' bytes]');
          }
      }
code_tokens: public function writeLiteral ( $ data , $ length , $ binary = false ) { $ this -> _buffer = '' ; $ success = false ; if ( $ data instanceof Horde_Stream ) { $ data = $ data -> stream ; } if ( rewind ( $ data ) ) { $ success = true ; while ( ! feof ( $ data ) ) { if ( ( ( $ read_data = fread ( $ data , 8192 ) ) === false ) || ( fwrite ( $ this -> _stream , $ read_data ) === false ) ) { $ success = false ; break ; } } } if ( ! $ success ) { $ this -> client_debug = true ; throw new Horde_Imap_Client_Exception ( Horde_Imap_Client_Translation :: r ( "Server write error." ) , Horde_Imap_Client_Exception :: SERVER_WRITEERROR ) ; } if ( $ this -> client_debug && ! empty ( $ this -> _params [ 'debugliteral' ] ) ) { rewind ( $ data ) ; while ( ! feof ( $ data ) ) { $ this -> _params [ 'debug' ] -> raw ( fread ( $ data , 8192 ) ) ; } } else { $ this -> _params [ 'debug' ] -> client ( '[' . ( $ binary ? 'BINARY' : 'LITERAL' ) . ' DATA: ' . $ length . ' bytes]' ) ; } }
docstring: Writes literal data to the IMAP output stream.
  
  @param mixed $data      Either a stream resource, or Horde_Stream
  object.
  @param integer $length  The literal length.
  @param boolean $binary  If true, this is binary data.
  
  @throws Horde_Imap_Client_Exception
docstring_tokens: Writes literal data to the IMAP output stream .