Exemplo n.º 1
0
        internal void WriteUTF8ResourceString(IntPtr pv, int offset, int size, bool asciiOnly)
        {
            if (_responseCodePage == CodePageUtils.CodePageUT8 || // response encoding is UTF8
                (asciiOnly && _responseCodePageIsAsciiCompat))    // ASCII resource and ASCII-compat encoding

            {
                _responseEncodingUsed = true;  // note the we used encoding (means that we need to generate charset=) see RAID#93415

                // write bytes directly
                if (_charBufferLength != _charBufferFree)
                {
                    FlushCharBuffer(true);
                }

                BufferResource(pv, offset, size);

                if (!_responseBufferingOn)
                {
                    _response.Flush();
                }
            }
            else
            {
                // have to re-encode with response's encoding -- use public Write(String)
                Write(StringResourceManager.ResourceToString(pv, offset, size));
            }
        }
Exemplo n.º 2
0
        internal int Append(IntPtr data, int offset, int size)
        {
            if (_free == 0 || size == 0)
            {
                return(0);
            }
            int n = (_free >= size) ? size : _free;

            StringResourceManager.CopyResource(data, offset, _data, _size - _free, n);
            _free -= n;
            return(n);
        }
Exemplo n.º 3
0
 /*
  * Get bytes (used only for filtering)
  */
 /*public*/ byte[] IHttpResponseElement.GetBytes()
 {
     if (_size > 0)
     {
         byte[] data = new byte[_size];
         StringResourceManager.CopyResource(_data, _offset, data, 0, _size);
         return(data);
     }
     else
     {
         return(new byte[0]);
     }
 }
Exemplo n.º 4
0
 internal void WriteUTF8ResourceString(IntPtr pv, int offset, int size, bool asciiOnly)
 {
     if (!this._responseEncodingUpdated)
     {
         this.UpdateResponseEncoding();
     }
     if ((this._responseCodePage == 0xfde9) || (asciiOnly && this._responseCodePageIsAsciiCompat))
     {
         this._responseEncodingUsed = true;
         if (this._charBufferLength != this._charBufferFree)
         {
             this.FlushCharBuffer(true);
         }
         this.BufferResource(pv, offset, size);
         if (!this._responseBufferingOn)
         {
             this._response.Flush();
         }
     }
     else
     {
         this.Write(StringResourceManager.ResourceToString(pv, offset, size));
     }
 }