Düzenle

Aracılığıyla paylaş


NSInputStream.GetBuffer(IntPtr, nuint) Method

Definition

This method can return a pointer to a buffer the caller can read data from.

[Foundation.Export("getBuffer:length:")]
protected virtual bool GetBuffer (out IntPtr buffer, out nuint len);
abstract member GetBuffer :  *  -> bool
override this.GetBuffer :  *  -> bool

Parameters

buffer
IntPtr

nativeint

Upon return points to the first of an array of bytes where the caller can read bytes from. The buffer is only valid until the next stream operation.

len
System.System.UIntPtr System.unativeint

Upon return specifies how many bytes can be written to the buffer.

Returns

A boolean value indicating whether the returned buffer is valid or not.

Attributes

Remarks

It is recommended to just return false from this method. An implementation must ensure that the returned byte pointer is not moved or collected by the garbage collector until the next stream operation is performed. One way of accomplishing this is with a pinned byte array (pinned with a GCHandle).

Applies to