Deprecated NSData Methods

A method identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in OS X v10.6

getBytes:

Copies a data object’s contents into a given buffer. (Deprecated in OS X v10.6. This method is unsafe because it could potentially cause buffer overruns. You should use getBytes:length: or getBytes:range: instead.)

- (void)getBytes:(void *)buffer
Parameters
buffer

A buffer into which to copy the receiver's data. The buffer must be at least length bytes.

Discussion

You can see a sample using this method in “Working With Binary Data”.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.6.
Declared In
NSData.h

Deprecated in OS X v10.7

dataWithContentsOfMappedFile:

Creates and returns a data object from the mapped file specified by path. (Deprecated in OS X v10.7.)

+ (id)dataWithContentsOfMappedFile:(NSString *)path
Parameters
path

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

Return Value

A data object from the mapped file specified by path. Returns nil if the data object could not be created.

Discussion

Because of file mapping restrictions, this method should only be used if the file is guaranteed to exist for the duration of the data object’s existence. It is generally safer to use the dataWithContentsOfFile: method.

This methods assumes mapped files are available from the underlying operating system. A mapped file uses virtual memory techniques to avoid copying pages of the file into memory until they are actually needed.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.7.
Related Sample Code
Declared In
NSData.h

initWithContentsOfMappedFile:

Returns a data object initialized by reading into it the mapped file specified by a given path. (Deprecated in OS X v10.7.)

- (id)initWithContentsOfMappedFile:(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 mapped file specified by path. The returned object might be different than the original receiver.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.7.
Declared In
NSData.h

Did this document help you? Yes It's good, but... Not helpful...