NSData

From GNUstepWiki
Jump to navigation Jump to search

NSData is a class in Foundation for working with binary data that does not fit any specific type. Methods are provided that work with generic data, such as reading and writing files, working with data in memory, and obtaining data over the network.

The data that an NSData object holds can come from a file, from a memory location, or from the network. Methods are provided that can move the data between all three of these. NSData is immutable, so a similar mutable type NSMutableData is provided (also in NSData.h). GNUstep defines extensions to NSData for use with shared memory. Also GNUstep adds methods to calculate a checksum and obtain various representations of the data (e.g. hexadecimal).

NSData inherits from NSObject. It is declared in Foundation/NSData.h and conforms to NSCoding, NSCopying, and NSMutableCopying.