Mac Guides | Samples

MonoMac.Foundation.NSData Class

Byte buffer manipulation.

See Also: NSData

Syntax

[MonoMac.Foundation.Register("NSData", true)]
public class NSData : NSObject, IEnumerable<byte>

Remarks

This wraps a byte array, this is the way that CocoaTouch represents strongly-typed byte-arrays and is consumed by various CocoaTouch APIs.

Requirements

Namespace: MonoMac.Foundation
Assembly: XamMac (in XamMac.dll)
Assembly Versions: 0.0.0.0

The members of MonoMac.Foundation.NSData are listed below.

See Also: NSObject

Public Constructors

Default constructor that initializes a new instance of this class with no parameters.
A constructor that initializes the object from the data stored in the unarchiver object.
Constructor to call on derived classes when the derived class has an [Export] constructor.
A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

Public Properties

[read-only]
BytesIntPtr. Returns a pointer to the data held by this NSData.
[read-only]
override
ClassHandleIntPtr. The handle for this class.
default property
Item(Int32)Byte. Retrieves the byte at the specified position in the NSData object.
LengthUInt32. The size of the contents wrapped by this NSData.

Public Methods

_Save(NSUrl, Int32, IntPtr) : Boolean
_Save(String, Int32, IntPtr) : Boolean
AsStream() : Stream
Wraps the NSData into System.IO.Stream
Find(NSData, NSDataSearchOptions, NSRange) : NSRange
Looks for the dataToFind in this NSData, based on the specified searchOptions in the specified range.
static
FromArray(Byte[]) : NSData
Creates an NSData that wraps a managed C# byte array.
static
FromBytes(IntPtr, UInt32) : NSData
Creates an NSData from an in-memory block by specifying its address and length.
static
FromData(NSData) : NSData
static
FromFile(String) : NSData
Creates an NSData by loading the contents of the specified file into memory.
static
FromFile(String, NSDataReadingOptions, out NSError) : NSData
Creates an NSData by loading the contents of the specified file into memory.
static
FromStream(Stream) : NSData
Creates an NSData by loading the contents of the provided stream.
static
FromString(String) : NSData
Creates an NSData for a C# string, the string is encoded in UTF8.
static
FromString(String, NSStringEncoding) : NSData
Creates an NSData for a C# string, the string is encoded using the specified encoding.
static
FromUrl(NSUrl) : NSData
Cretes an NSData with the contents in the specified url.
static
FromUrl(NSUrl, NSDataReadingOptions, out NSError) : NSData
Cretes an NSData with the contents in the specified url.
Save(NSUrl, Boolean, out NSError) : Boolean
Save(String, NSDataWritingOptions, out NSError) : Boolean
Save(String, Boolean, out NSError) : Boolean
override
ToString() : String
Returns a string representation of the value of the current instance.
ToString(NSStringEncoding) : NSString
Returns a string representation of the value of the current instance.

Public Operators

static
Conversion to MonoMac.Foundation.NSData(Implicit)Implicit conversion from string to an NSData encoded as UTF8.

Explicitly Implemented Interface Members

NSData$IEnumerable<Byte>.GetEnumeratorEnumerator for the NSDatac contents.
NSData$IEnumerable.GetEnumeratorEnumerator for the NSDatac contents.