This class is used to read and write data to and from an open file or
open communications channel, such as a networking socket. The class
provides methods for working with files, and contains methods and
notifications useful for implementing
asynchronous background socket
communication.
@interface NSFileHandle : NSObject
|
// Initializers |
- (id)initWithFileDescriptor:(int)fd;
|
- (id)initWithFileDescriptor:(int)fd closeOnDealloc:(BOOL)closeopt;
|
- (id)initWithNativeHandle:(void *)nativeHandle;
|
- (id)initWithNativeHandle:(void *)nativeHandle closeOnDealloc:(BOOL)closeopt;
|
// Class Methods |
+ (id)fileHandleForReadingAtPath:(NSString *)path;
|
+ (id)fileHandleForUpdatingAtPath:(NSString *)path;
|
+ (id)fileHandleForWritingAtPath:(NSString *)path;
|
+ (id)fileHandleWithNullDevice;
|
+ (id)fileHandleWithStandardError;
|
+ (id)fileHandleWithStandardInput;
|
+ (id)fileHandleWithStandardOutput;
|
// Instance Methods |
- (void)acceptConnectionInBackgroundAndNotify;
|
- (void)acceptConnectionInBackgroundAndNotifyForModes:(NSArray *)modes;
|
- (NSData *)availableData;
|
- (void)closeFile;
|
- (int)fileDescriptor;
|
- (void *)nativeHandle;
|
- (unsigned long long)offsetInFile;
|
- (NSData *)readDataOfLength:(unsigned int)length;
|
- (NSData *)readDataToEndOfFile;
|
- (void)readInBackgroundAndNotify;
|
- (void)readInBackgroundAndNotifyForModes:(NSArray *)modes;
|
- (void)readToEndOfFileInBackgroundAndNotify;
|
- (void)readToEndOfFileInBackgroundAndNotifyForModes:(NSArray *)modes;
|
- (unsigned long long)seekToEndOfFile;
|
- (void)seekToFileOffset:(unsigned long long)offset;
|
- (void)synchronizeFile;
|
- (void)truncateFileAtOffset:(unsigned long long)offset;
|
- (void)waitForDataInBackgroundAndNotify;
|
- (void)waitForDataInBackgroundAndNotifyForModes:(NSArray *)modes;
|
- (void)writeData:(NSData *)data;
|