Upravit

Sdílet prostřednictvím


NSDataReadingOptions Enum

Definition

Flags that determine how NSData loads files.

This enumeration supports a bitwise combination of its member values.

[System.Flags]
public enum NSDataReadingOptions
type NSDataReadingOptions = 
Inheritance
NSDataReadingOptions
Attributes

Fields

Name Value Description
Mapped 1

Use the kernel's virtual memory map to load the file, if possible. If sucessful, this replaces read/write memory that can be very expensive with discardable memory that is backed by a file.

Uncached 2

Notify the kernel that it should not try to cache the contents of this file in its buffer cache.

Coordinated 4
MappedAlways 8

Force NSData to try to use the kernel's mapping support to load the file. If sucessful, this replaces read/write memory that can be very expensive with discardable memory that is backed by a file.

Remarks

By default NSData will loads the contents of the file in memory by allocating a block of memory and then reading the contents of the file into it.

The Mapped and MappedAlways parameter instruct NSData to use the kernel's interface to map the file into the process address space. This has a few advantages: instead of allocating read/write memory for the process, that becomes real memory usage, the mapped versions map the file into memory which means that the data is loaded on demand instead of being loaded upfront. This also allows the kernel to discard the data loaded from memory when the system is running low on memory.

Applies to