4
Copyright (C) 1995, 1996, 1997 Ovidiu Predescu and Mircea Oancea.
7
Author: Ovidiu Predescu <ovidiu@net-community.com>
10
This file is part of libFoundation.
12
Permission to use, copy, modify, and distribute this software and its
13
documentation for any purpose and without fee is hereby granted, provided
14
that the above copyright notice appear in all copies and that both that
15
copyright notice and this permission notice appear in supporting
18
We disclaim all warranties with regard to this software, including all
19
implied warranties of merchantability and fitness, in no event shall
20
we be liable for any special, indirect or consequential damages or any
21
damages whatsoever resulting from loss of use, data or profits, whether in
22
an action of contract, negligence or other tortious action, arising out of
23
or in connection with the use or performance of this software.
25
#ifndef __NSConcreteFileHandle_h__
26
#define __NSConcreteFileHandle_h__
28
#include <Foundation/NSPosixFileDescriptor.h>
29
#include <Foundation/NSFileHandle.h>
31
@class NSPosixFileDescriptor;
34
NSFileHandleNoOperation = 0,
35
NSFileHandleAcceptOperation,
36
NSFileHandleReadOperation,
37
NSFileHandleReadToEndOfFileOperation
38
} NSFileHandleOperation;
41
NSFileHandleNoType = 0,
50
@interface NSConcreteFileHandle : NSPosixFileDescriptor
55
NSFileHandleOperation operation;
56
NSFileHandleType type;
60
/* Creating an NSFileHandle */
61
- (id)initWithFileDescriptor:(int)fd;
62
- (id)initWithFileDescriptor:(int)fd closeOnDealloc:(BOOL)flag;
63
- (id)initWithPath:(NSString *)aPath flags:(int)flags createMode:(int)mode;
68
@interface NSConcreteFileHandle (NSFileHandleOperations)
70
/* Getting a file descriptor */
71
- (int)fileDescriptor;
73
/* Reading from an NSFileHandle */
74
- (NSData *)availableData;
75
- (NSData *)readDataToEndOfFile;
76
- (NSData *)readDataOfLength:(unsigned int)length;
78
/* Writing to an NSFileHandle */
79
- (void)writeData:(NSData *)data;
81
/* Communicating asynchronously in the background */
82
- (void)acceptConnectionInBackgroundAndNotifyForModes:(NSArray *)modes;
83
- (void)acceptConnectionInBackgroundAndNotify;
84
- (void)readInBackgroundAndNotifyForModes:(NSArray *)modes;
85
- (void)readInBackgroundAndNotify;
86
- (void)readToEndOfFileInBackgroundAndNotifyForModes:(NSArray *)modes;
87
- (void)readToEndOfFileInBackgroundAndNotify;
89
/* Seeking within a file */
90
- (unsigned long long)offsetInFile;
91
- (unsigned long long)seekToEndOfFile;
92
- (void)seekToFileOffset:(unsigned long long)offset;
94
/* Operating on a file */
96
- (void)synchronizeFile;
97
- (void)truncateFileAtOffset:(unsigned long long)offset;
102
@interface NSNullDeviceFileHandle : NSFileHandle
105
@interface NSConcretePipeFileHandle : NSFileHandle
113
#endif /* __NSConcreteFileHandle_h__ */