System.Net.Browser.BrowserHttpWebResponse.Write C# (CSharp) Méthode

Write() private méthode

private Write ( IntPtr buffer, int count ) : void
buffer IntPtr
count int
Résultat void
		internal void Write (IntPtr buffer, int count)
		{
			byte[] data = new byte [count];
			Marshal.Copy (buffer, data, 0, count);
			response.Write (data, 0, count);
		}

Usage Example

Exemple #1
0
        void OnAsyncDataAvailable(IntPtr sender, IntPtr calldata, IntPtr closure)
        {
            IntPtr data   = IntPtr.Zero;
            uint   length = 0;
            BrowserHttpWebResponse response = async_result.Response as BrowserHttpWebResponse;

            try {
                data        = NativeMethods.http_request_write_event_args_get_data(calldata);
                length      = NativeMethods.http_request_write_event_args_get_count(calldata);
                bytes_read += length;
                if (progress != null)
                {
                    // if Content-Encoding is gzip (or other compressed) then Content-Length cannot be trusted,
                    // if present, since it does not (generally) correspond to the uncompressed length
                    long content_length         = response.ContentLength;
                    bool compressed             = (response.IsCompressed || (content_length == 0));
                    long total_bytes_to_receive = compressed ? -1 : content_length;
                    progress(bytes_read, total_bytes_to_receive);
                }
            } catch (Exception e) {
                async_result.Exception = e;
            }

            try {
                if (data != IntPtr.Zero && length != 0)
                {
                    response.Write(data, checked ((int)length));
                }
            } catch (Exception e) {
                async_result.Exception = e;
            }
        }