iOS Guides | Samples

MonoTouch.Foundation.NSData Class

Byte buffer manipulation.

See Also: NSData

Syntax

[MonoTouch.Foundation.Register("NSData", true)]
public class NSData : NSObject, INSMutableCopying, INSSecureCoding, IEnumerable<byte>, IDisposable

Remarks

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

Related content

Requirements

Namespace: MonoTouch.Foundation
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0

The members of MonoTouch.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 to skip initialization and merely allocate the object.
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
Copy(NSZone) : NSObject
Performs a copy of the underlying Objective-C object.
EnumerateByteRange(NSDataByteRangeEnumerator)
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
FromBytesNoCopy(IntPtr, UInt32) : NSData
static
FromBytesNoCopy(IntPtr, UInt32, Boolean) : NSData
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.
GetBase64EncodedData(NSDataBase64EncodingOptions) : NSData
GetBase64EncodedString(NSDataBase64EncodingOptions) : String
GetBytes(IntPtr, NSRange)
GetBytes(IntPtr, UInt32)
MutableCopy(NSZone) : NSObject
Performs a copy of the underlying Objective-C object.
Save(NSUrl, Boolean) : Boolean
Save(String, Boolean) : Boolean
Save(NSUrl, NSDataWritingOptions, out NSError) : Boolean
Save(NSUrl, Boolean, out NSError) : Boolean
Save(String, NSDataWritingOptions, out NSError) : Boolean
Save(String, Boolean, out NSError) : Boolean
Subdata(NSRange) : NSData
ToArray() : Byte[]
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 MonoTouch.Foundation.NSData(Implicit)Implicit conversion from string to an NSData encoded as UTF8.

Explicitly Implemented Interface Members

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