home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / NSFileHandle.h < prev    next >
Text File  |  1996-09-11  |  3KB  |  101 lines

  1. /*    NSFileHandle.h
  2.     Basic operations on open files and communication channels
  3.     Copyright 1994-1996, NeXT Software, Inc.  All rights reserved.
  4. */
  5.  
  6. #if !defined(STRICT_OPENSTEP)
  7.  
  8. #import <Foundation/NSObject.h>
  9. #import <Foundation/NSArray.h>
  10. #import <Foundation/NSRange.h>
  11.  
  12. @class NSString, NSData;
  13.  
  14. @interface NSFileHandle : NSObject
  15.  
  16. - (NSData *)availableData;
  17.  
  18. - (NSData *)readDataToEndOfFile;
  19. - (NSData *)readDataOfLength:(unsigned int)length;
  20.  
  21. - (void)writeData:(NSData *)data;
  22.  
  23. - (unsigned long long)offsetInFile;
  24. - (unsigned long long)seekToEndOfFile;
  25. - (void)seekToFileOffset:(unsigned long long)offset;
  26.  
  27. - (void)truncateFileAtOffset:(unsigned long long)offset;
  28. - (void)synchronizeFile;
  29. - (void)closeFile;
  30.  
  31. @end
  32.  
  33. @interface NSFileHandle (NSFileHandleCreation)
  34.  
  35. + (id)fileHandleWithStandardInput;
  36. + (id)fileHandleWithStandardOutput;
  37. + (id)fileHandleWithStandardError;
  38.  
  39. #if !defined(STRICT_40)
  40. + (id)fileHandleWithNullDevice;
  41. #endif
  42.  
  43. + (id)fileHandleForReadingAtPath:(NSString *)path;
  44. + (id)fileHandleForWritingAtPath:(NSString *)path;
  45. + (id)fileHandleForUpdatingAtPath:(NSString *)path;
  46.  
  47. @end
  48.  
  49. FOUNDATION_EXPORT NSString *NSFileHandleOperationException;
  50.  
  51. FOUNDATION_EXPORT NSString *NSFileHandleReadCompletionNotification;
  52. FOUNDATION_EXPORT NSString *NSFileHandleReadToEndOfFileCompletionNotification;
  53. FOUNDATION_EXPORT NSString *NSFileHandleConnectionAcceptedNotification;
  54.  
  55. FOUNDATION_EXPORT NSString *NSFileHandleNotificationDataItem;
  56. FOUNDATION_EXPORT NSString *NSFileHandleNotificationFileHandleItem;
  57. FOUNDATION_EXPORT NSString *NSFileHandleNotificationMonitorModes;
  58.  
  59. @interface NSFileHandle (NSFileHandleAsynchronousAccess)
  60.  
  61. - (void)readInBackgroundAndNotifyForModes:(NSArray *)modes;
  62. - (void)readInBackgroundAndNotify;
  63.  
  64. - (void)readToEndOfFileInBackgroundAndNotifyForModes:(NSArray *)modes;
  65. - (void)readToEndOfFileInBackgroundAndNotify;
  66.  
  67. - (void)acceptConnectionInBackgroundAndNotifyForModes:(NSArray *)modes;
  68. - (void)acceptConnectionInBackgroundAndNotify;
  69.  
  70. @end
  71.  
  72. @interface NSFileHandle (NSFileHandlePlatformSpecific)
  73.  
  74. #if defined(WIN32)
  75. #if !defined(STRICT_40)
  76. - (id)initWithNativeHandle:(void *)nativeHandle closeOnDealloc:(BOOL)closeopt;
  77. #endif
  78. - (id)initWithNativeHandle:(void *)nativeHandle;
  79. - (void *)nativeHandle;
  80. #endif
  81.  
  82. #if !defined(STRICT_40)
  83. - (id)initWithFileDescriptor:(int)fd closeOnDealloc:(BOOL)closeopt;
  84. #endif
  85. - (id)initWithFileDescriptor:(int)fd;
  86. - (int)fileDescriptor;
  87.  
  88. @end
  89.  
  90. @interface NSPipe : NSObject
  91.  
  92. - (NSFileHandle *)fileHandleForReading;
  93. - (NSFileHandle *)fileHandleForWriting;
  94.  
  95. - (id)init;
  96. + (id)pipe;
  97.  
  98. @end
  99.  
  100. #endif /* !STRICT_OPENSTEP */
  101.