示例#1
0
        // Encodes the specified binary bytes as base64 and writes out the resulting text.
        public override void WriteBase64(byte[] buffer, int index, int count)
        {
            try
            {
                if (!_flush)
                {
                    AutoComplete(Token.Base64);
                }

                _flush = true;
                // No need for us to explicitly validate the args. The StreamWriter will do
                // it for us.
                if (null == _base64Encoder)
                {
                    _base64Encoder = new XmlTextWriterBase64Encoder(_xmlEncoder);
                }
                // Encode will call WriteRaw to write out the encoded characters
                _base64Encoder.Encode(buffer, index, count);
            }
            catch
            {
                _currentState = State.Error;
                throw;
            }
        }
 public override void WriteBase64(byte[] buffer, int index, int count)
 {
     try
     {
         if (!this.flush)
         {
             this.AutoComplete(Token.Base64);
         }
         this.flush = true;
         if (this.base64Encoder == null)
         {
             this.base64Encoder = new XmlTextWriterBase64Encoder(this.xmlEncoder);
         }
         this.base64Encoder.Encode(buffer, index, count);
     }
     catch
     {
         this.currentState = State.Error;
         throw;
     }
 }