Example #1
0
        public CFDataBuffer(byte[] buffer)
        {
            this.buffer = buffer;
            this.handle = GCHandle.Alloc (this.buffer, GCHandleType.Pinned);

            data = CFData.FromDataNoCopy (handle.AddrOfPinnedObject (), buffer.Length);
            owns = true;
        }
Example #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (data != null)
     {
         data.Dispose();
         data = null;
     }
 }
Example #3
0
        public CFDataBuffer(byte[] buffer)
        {
            this.buffer = buffer;

            /*
             * Copy the buffer to allow the native side to take ownership.
             */

            var gch = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            data = CFData.FromData(gch.AddrOfPinnedObject(), buffer.Length);
            gch.Free();
        }
		public CFDataBuffer (byte[] buffer)
		{
			this.buffer = buffer;

			/*
			 * Copy the buffer to allow the native side to take ownership.
			 */

			var gch = GCHandle.Alloc (buffer, GCHandleType.Pinned);
			data = CFData.FromData (gch.AddrOfPinnedObject (), buffer.Length);
			gch.Free ();
			owns = true;
		}
		internal void SetBody (CFData data)
		{
			CFHTTPMessageSetBody (Handle, data.Handle);
		}
Example #6
0
 public CFDataBuffer(IntPtr ptr)
 {
     data = new CFData (ptr, false);
     buffer = data.GetBuffer ();
     owns = false;
 }
Example #7
0
 protected virtual void Dispose(bool disposing)
 {
     if (data != null) {
         data.Dispose ();
         if (owns)
             handle.Free ();
         data = null;
     }
 }
Example #8
0
		internal void SetBody (CFData data)
		{
			ThrowIfDisposed ();
			CFHTTPMessageSetBody (Handle, data.Handle);
		}
Example #9
0
 public CFDataBuffer(IntPtr ptr)
 {
     data   = new CFData(ptr, false);
     buffer = data.GetBuffer();
 }
		protected virtual void Dispose (bool disposing)
		{
			if (data != null) {
				data.Dispose ();
				data = null;
			}
		}