ftp.nice.ch/peanuts/GeneralData/Documents/openstep/OpenStepSpec_rtf.tar.gz#/OpenStepSpec_rtf/FoundationKit/Classes/NSData.rtf

This is NSData.rtf in view mode; [Download] [Up]

paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc.  All Rights Reserved.

s4 li100 fi0 ri1007 ql f0 b fs36 fs100 
fs36 NSData 
pard s11 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 
fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSObject
fs20 
fs28 s6 f0 b fs24 Conforms To:tab b0 fs28 f1 NSCoding, NSCopying, NSMutableCopying
fi0 NSObject (NSObject)
fs20 
fs28 s7 fi-2771 f0 b fs24 Declared In:tab b0 fs28 f1 Foundation/NSData.h 
fs20 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs28 fs20 
fs28 Class Description
fs14 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 
fs28 The NSData class declares the programmatic interface to objects that contain data in the form of bytes. NSData objects hold a static collection of bytes; NSData'27s subclass, NSMutableData, defines objects that hold modifiable data. These two classes provide an object-oriented approach to memory allocation, a facility that in procedural programming is accessed through functions like b malloc()b0 . Furthermore, these classes take advantage of operating system primitives when allocating large blocks of memory.
fs16 
fs28 NSData'27s two primitive methods'd0b bytesb0  and b lengthb0 'd0provide the basis for all the other methods in its interface. The b bytesb0  method returns a pointer to the bytes contained in the data object. b length b0 returns the number of bytes contained in the data object. 
fs16 
fs28 NSData and NSMutableData objects are commonly used to hold the contents of a file. The methods b dataWithContentsOfFile:b0  and b dataWithContentsOfMappedFile:b0  return objects that represent a file'27s contents. The b writeToFile:atomically:b0  method enables you to write the contents of a data object to a file.
fs16 
fs28 NSData provides access methods for copying bytes from a data object into a buffer. Use b getBytes:b0  to copy the entire contents of the object or b getBytes:length:b0  to copy a subset, starting with the first byte. b getBytes:range:b0  copies a range of bytes from a starting point within the bytes themselves. You can also return a data object that contains a subset of the bytes in another data object by using the b subdataWithRange:b0  method. Or, you can use the b descriptionb0  method to return an NSString representation of the bytes in a data object.
fs16 
fs28 For determining if two data objects are equal, NSData provides theb  isEqualToData:b0  method, which does a byte-for-byte comparison.
fs16 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs24 
fs28 Allocating and Initializing an NSData Object
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 + (id)b allocWithZone:b0 (NSZone *)i zonei0 tab Creates and returns an uninitialized object from i zonei0 .
fi-6552 fs16 
fs28 fi-6552 + (id)b datab0 tab Creates and returns an empty object. This method is declared primarily for mutable subclasses of NSData.
fi-6552 fs16 
fs28 fi-6552 + (id)b dataWithBytes:b0 (const void *)i bytesi0 tab Creates and returns an object containingi  lengthi0  bytes
s9 li7030 fi-6553 fi-5796 b length:b0 (unsigned int)i lengthi0 tab  tab  of data copied from the buffer i bytesi0 .
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 + (id)b dataWithBytesNoCopy:b0 (void *)i bytesi0 tab Creates and returns an object containing i lengthi0  bytes
s9 li7030 fi-6553 fi-5796 b length:b0 (unsigned int)i lengthi0 tab  tab from the buffer i bytesi0 .
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 + (id)b dataWithContentsOfFile:b0 (NSString *)i pathi0 tab Creates and returns an object by reading data from the file specified by i pathi0 .
fi-6552 fs16 
fs28 fi-6552 + (id)b dataWithContentsOfMappedFile:b0 (NSString *)i path
s9 li7030 fi-6553 fi-5796 i0 tab Creates and returns an object whose contents come from the mapped file i pathi0 , assuming mapped files are available on the underlying operating system. If mapped files are not available, this method is identical to b dataWithContentsOfFile:b0 .
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b initWithBytes:b0 (const void *)i bytesi0 tab Initializes a newly allocated NSData object by putting in it 
s9 li7030 fi-6553 fi-5796 length:(unsigned int)i lengthi0 tab b i  i0 tab b0 i lengthb  b0 i0 bytes of data copied from the buffer bytes.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b initWithBytesNoCopy:b0 (void *)i bytesi0 tab Initializes a newly allocated NSData object by putting in it
s9 li7030 fi-6553 fi-5796 length:(unsigned int)i lengthi0 tab b  i tab b0 lengthb  b0 i0 bytes of data from the buffer bytes.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b initWithContentsOfFile:b0 (NSString *)i pathi0 tab Initializes a newly allocated NSData object by reading into it the data from the file specified byb  b0 i pathb i0 .
fi-6552 b0 fs16 
fs28 fi-6552 {f3 -} (id)b initWithContentsOfMappedFile:b0 (NSString *)i path
s9 li7030 fi-6553 fi-5796 i0 tab Initializes a newly allocated NSData object to contain the data residing in the mapped fileb  b0 i pathi0 , assuming mapped files are available on the underlying operating system. If mapped files are not available, this method is identical to b initWithContentsOfFile:b0 .
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b initWithData:b0 (NSData *)i datai0 tab Initializes a newly allocated NSData object by placing in it the contents of another NSData object,b  b0 i datai0 .
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Accessing Data 
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (const void *)b bytesb0 tab Returns a pointer to the object'27s contents. This method returns read-only access to the data.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b descriptionb0 tab Returns an NSString object that contains a hexadecimal representation of the the receiver'27s contents.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b getBytes:b0 (void *)i bufferi0 tab Copies the receiver'27s contents intob  b0 i bufferb i0 .
fi-6552 b0 fs16 
fs28 fi-6552 {f3 -} (void)b getBytes:b0 (void *)i bufferi0 tab Copies length bytes of the receiver'27s contents intob  b0 i bufferb i0 .
s9 li7030 fi-6553 fi-5796 b0 b length:b0 (unsigned int)i lengthi0 tab 
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b getBytes:b0 (void *)i bufferi0 tab Copies intob  b0 i bufferb i0  b0 the portion of the receiver'27s contents
s9 li7030 fi-6553 fi-5796 range:(NSRange)aRangetab  tab withinb  b0 i aRangeb i0 . b0 Raises ani  i0 NSRangeExceptioni  i0 ifi  aRangei0  is not within the range of the receiver'27s data.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSData *)b subdataWithRange:b0 (NSRange)i aRangei0 tab Returns an object containing a copy of the receiver'27s bytes that fall within the limits specified by i aRangei0 . Raises ani  i0 NSRangeExceptioni  i0 ifi  aRangei0  is not within the range of the receiver'27s data.
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Querying a Data Object
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (BOOL)b isEqualToData:b0 (NSData *)i otheri0 tab Compares the receiving object to other. If the contents ofb  b0 i otheri0  are equal to the contents of the receiver, this method returns YES. If not, it returns NO.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (unsigned int)b lengthb0 tab Returns the number of bytes contained in the receiver.
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Storing Data
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (BOOL)b writeToFile:b0 (NSString *)i pathi0 tab Writes the bytes in the receiving object to the file specified
s9 li7030 fi-6553 fi-5796 b atomically:b0 (BOOL)i useAuxiliaryFilei0 tab tab by i pathi0 . Ifi  useAuxiliaryFilei0  is YES, the data is written to a backup file and then, assuming no errors occur, the backup file is renamed atomically to the intended file name.
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Deserializing Data
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (unsigned int)b deserializeAlignedBytesLengthAtCursor:b0 (unsigned int*)i cursor
s9 li7030 fi-6553 fi-5796 i0 tab Returns the length of the serialized bytes at the location referenced by i cursori0 . If the bytes have been page-aligned, it also obtains the relevant 'aahole'ba information and adjusts the cursor. An invocation of this method must have a corresponding b serializeAlignedBytesLength:b0  invocation.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b deserializeBytes:b0 (void *)i bufferi0 tab Deserializes i bytesi0  number of bytes in the buffer pointed 
s9 li7030 fi-6553 fi-5796 b length:b0 (unsigned int)i bytesi0 tab tab at by i bufferi0 , places them internally starting at i cursori0 , 
b atCursor:b0 (unsigned int*)i cursori0 tab tab and advances the cursor. 
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b deserializeDataAt:b0 (void *)i datai0 tab Deserializes the data pointed at by i cursori0 , interpreting it
s9 li7030 fi-6553 fi-5796 b ofObjCType:b0 (const char *)i typei0 tab tab by the Objective C type specifier i typei0  and writing it 
b atCursor:b0 (unsigned int*)i cursori0 tab tab to the memory location referenced by i datai0 . If the data
b context:b0 (id <NSObjCTypeSerializationCallBack>)tab tab element is an object other than an instance of
i                                                               callback       i0 tab NSDictionary, NSArray, NSString, or NSData, a callback from object i callbacki0  can provide further definition of the object. All Objective C types are currently supported except b unionb0  and b void *b0 . Pointers refer to a single item.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (int)b deserializeIntAtCursor:b0 (unsigned int*)i cursori0 tab Deserializes and returns the integer encoded at i cursori0 . Also advances the cursor.
pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 fs16 
fs28 fi-6552 {f3 -} (int)b deserializeIntAtIndex:b0 (unsigned int)i indexi0 tab Deserializes and returns the integer encoded at offset i indexi0 . Does not advance the cursor.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b deserializeInts:b0 (int *)i intBufferi0 tab Deserializes i numIntsi0  integers encoded at the location 
s9 li7030 fi-6553 fi-5796 b count:b0 (unsigned int)i numIntsi0 tab tab referenced by i cursori0  and puts them in the buffer 
b atCursor:b0 (unsigned int*)i cursori0 tab tab i intBufferi0 . Also advances the cursor.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b deserializeInts:b0 (int *)i intBufferi0 tab Deserializes i numIntsi0  integers encoded at offset i index
s9 li7030 fi-6553 fi-5796 i0 b count:b0 (unsigned int)i numIntsi0 tab tab and puts them in the buffer i intBufferi0 . Does not advance 
b atIndex:b0 (unsigned int)i indexi0 tab tab the cursor.
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.