O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSFileWrapper — Mac OS X 10.0

Synopsis

This class is used to represent a file, or a set of files contained in a file package, as a single unit of information in a document or application. NSFileWrapper is often used in conjunction with subclasses of NSDocument as a means of conveniently managing a document’s data. This class provides functionality that allows clients to edit file attributes and perform file operations. Additionally, clients may assign an icon to represent the file wrapper object in dragging operations.

image with no caption

@interface NSFileWrapper : NSObject <NSCoding>
                                  // Initializers
   - (id)initDirectoryWithFileWrappers:(NSDictionary *)docs;
   - (id)initRegularFileWithContents:(NSData *)data;
   - (id)initSymbolicLinkWithDestination:(NSString *)path;
   - (id)initWithPath:(NSString *)path;
   - (id)initWithSerializedRepresentation:(NSData *)data;
                                  // Accessor Methods
   - (void)setFilename:(NSString *)filename;
   - (NSString *)filename;
   - (void)setIcon:(NSImage *)icon;
   - (NSImage *)icon;
   - (void)setFileAttributes:(NSDictionary *)attributes;
   - (NSDictionary *)fileAttributes;
   - (void)setPreferredFilename:(NSString *)filename;
   - (NSString *)preferredFilename;
                                  // Instance Methods
   - (NSString *)addFileWithPath:(NSString *)path;
   - (NSString *)addFileWrapper:(NSFileWrapper *)doc;
   - (NSString *)addRegularFileWithContents:(NSData *)data 
                                 preferredFilename:(NSString ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required