Instance Method

initWithContentsOfFile:

Initializes a data object with the content of the file at a given path.

Declaration

- (instancetype)initWithContentsOfFile:(NSString *)path;

Parameters

path

The absolute path of the file from which to read data.

Return Value

A data object initialized by reading into it the data from the file specified by path.

Discussion

This method is equivalent to initWithContentsOfFile:options:error: with no options.

See Also

Reading Data from a File

+ dataWithContentsOfFile:

Creates a data object by reading every byte from the file at a given path.

+ dataWithContentsOfFile:options:error:

Creates a data object by reading every byte from the file at a given path.

+ dataWithContentsOfURL:

Creates a data object containing the data from the location specified by a given URL.

+ dataWithContentsOfURL:options:error:

Creates a data object containing the data from the location specified by a given URL.

- initWithContentsOfFile:options:error:

Initializes a data object with the content of the file at a given path.

- initWithContentsOfURL:

Initializes a data object with the data from the location specified by a given URL.

- initWithContentsOfURL:options:error:

Initializes a data object with the data from the location specified by a given URL.

NSDataReadingOptions

Options for methods used to read data objects.

- initWithContentsOfMappedFile:

Initializes a data object with the contents of the mapped file specified by a given path.

Deprecated
+ dataWithContentsOfMappedFile:

Creates a data object from the mapped file at a given path.

Deprecated