NSFileWrapper Mac OS X 10.0

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.


@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 *)filename;
   - (NSString *)addSymbolicLinkWithDestination:(NSString *)path preferredFilename:(NSString *)filename;
   - (NSDictionary *)fileWrappers;
   - (BOOL)isDirectory;
   - (BOOL)isRegularFile;
   - (BOOL)isSymbolicLink;
   - (NSString *)keyForFileWrapper:(NSFileWrapper *)doc;
   - (BOOL)needsToBeUpdatedFromPath:(NSString *)path;
   - (NSData *)regularFileContents;
   - (void)removeFileWrapper:(NSFileWrapper *)doc;
   - (NSData *)serializedRepresentation;
   - (NSString *)symbolicLinkDestination;
   - (BOOL)updateFromPath:(NSString *)path;
   - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)atomicFlag updateFilenames:(BOOL)updateFilenamesFlag;
 // Methods Implementing NSCoding
   - (void)encodeWithCoder:(NSCoder *)aCoder;
   - (id)initWithCoder:(NSCoder *)aDecoder;

    Part II: API Quick Reference
    Chapter 13. Foundation Classes