dataRepresentationOfType:
A primitive method to return a data object that represents the data of the receiver in a given type.
Declaration
- (NSData *) dataRepresentationOfType:(NSString *) type;Discussion
A primitive method overridden by subclasses to return a data object that represents the data of the receiver in a given type (aType). The default implementation raises an NSInternalInconsistencyException. This method is invoked by the default implementation of fileWrapperRepresentationOfType:.
aType is the type name corresponding to the value of the CFBundleTypeName entry in the document type’s Info.plist dictionary.
Here is a typical implementation:
//Document type name
NSString *MyDocumentType = @"Rich Text Format (RTF) document";
...
- (NSData *)dataRepresentationOfType:(NSString *)aType {
NSAssert([aType isEqualToString:MyDocumentType], @"Unknown type");
return [textView RTFFromRange:NSMakeRange(0, [[textView textStorage] length])];
}See Also
Methods
fileAttributesToWriteToFile:ofType:saveOperation:fileNamefileWrapperRepresentationOfType:initWithContentsOfFile:ofType:initWithContentsOfURL:ofType:loadDataRepresentation:ofType:loadFileWrapperRepresentation:ofType:printShowingPrintPanel:readFromFile:ofType:readFromURL:ofType:revertToSavedFromFile:ofType:revertToSavedFromURL:ofType:runModalPageLayoutWithPrintInfo:saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:saveToURL:ofType:forSaveOperation:error: