Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSFileHandleMBS class.
NSFileHandleMBS.fileHandleForReadingAtFile(path as folderitem) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
path: The path to the file, device, or named socket to access.
Returns the initialized file handle, or nil if no file exists at path.
The file pointer is set to the beginning of the file. The returned object responds only to NSFileHandle read... messages.
Some examples using this method:
NSFileHandleMBS.fileHandleForReadingAtPath(path as string) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
path: The path to the file, device, or named socket to access.
Returns the initialized file handle, or nil if no file exists at path.
The file pointer is set to the beginning of the file. The returned object responds only to NSFileHandle read... messages.
NSFileHandleMBS.fileHandleForReadingFromFile(URL as folderitem, byref error as NSErrorMBS) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: The URL of the file, device, or named socket to access.
error: If an error occurs, upon return contains an NSError object that describes the problem.
Returns the initialized file handle, or nil if no file exists at url.
The file pointer is set to the beginning of the file. The returned object responds only to NSFileHandleread... messages.
NSFileHandleMBS.fileHandleForReadingFromURL(URL as string, byref error as NSErrorMBS) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: The URL of the file, device, or named socket to access.
error: If an error occurs, upon return contains an NSError object that describes the problem.
Returns the initialized file handle, or nil if no file exists at url.
The file pointer is set to the beginning of the file. The returned object responds only to NSFileHandleread... messages.
NSFileHandleMBS.fileHandleForUpdatingAtFile(path as folderitem) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
path: The path to the file, device, or named socket to access.
Returns the initialized file handle, or nil if no file exists at path.
The file pointer is set to the beginning of the file. The returned object responds to both NSFileHandle read... messages and writeData.
NSFileHandleMBS.fileHandleForUpdatingAtPath(path as string) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
path: The path to the file, device, or named socket to access.
Returns the initialized file handle, or nil if no file exists at path.
The file pointer is set to the beginning of the file. The returned object responds to both NSFileHandle read... messages and writeData.
NSFileHandleMBS.fileHandleForUpdatingFile(URL as folderitem, byref error as NSErrorMBS) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: The URL of the file, device, or named socket to access.
error: If an error occurs, upon return contains an NSError object that describes the problem.
The initialized file handle, or nil if no file exists at url.
The file pointer is set to the beginning of the file. The returned object responds to both NSFileHandleread... messages and writeData.
NSFileHandleMBS.fileHandleForUpdatingURL(URL as string, byref error as NSErrorMBS) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: The URL of the file, device, or named socket to access.
error: If an error occurs, upon return contains an NSError object that describes the problem.
The initialized file handle, or nil if no file exists at url.
The file pointer is set to the beginning of the file. The returned object responds to both NSFileHandleread... messages and writeData.
NSFileHandleMBS.fileHandleForWritingAtFile(path as folderitem) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
path: The path to the file, device, or named socket to access.
Returns the initialized file handle, or nil if no file exists at path.
The file pointer is set to the beginning of the file. The returned object responds only to writeData.
NSFileHandleMBS.fileHandleForWritingAtPath(path as string) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
path: The path to the file, device, or named socket to access.
Returns the initialized file handle, or nil if no file exists at path.
The file pointer is set to the beginning of the file. The returned object responds only to writeData.
NSFileHandleMBS.fileHandleForWritingToFile(URL as folderitem, byref error as NSErrorMBS) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: The URL of the file, device, or named socket to access.
error: If an error occurs, upon return contains an NSError object that describes the problem.
Returns the initialized file handle, or nil if no file exists at url.
The file pointer is set to the beginning of the file. The returned object responds only to writeData.
NSFileHandleMBS.fileHandleForWritingToURL(URL as string, byref error as NSErrorMBS) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: The URL of the file, device, or named socket to access.
error: If an error occurs, upon return contains an NSError object that describes the problem.
Returns the initialized file handle, or nil if no file exists at url.
The file pointer is set to the beginning of the file. The returned object responds only to writeData.
NSFileHandleMBS.fileHandleWithFileDescriptor(fd as Integer) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
You can create a file handle for a socket by using the result of a socket call as fileDescriptor.
The object creating a file handle using this method owns fileDescriptor and is responsible for its disposition.
See also:
NSFileHandleMBS.fileHandleWithFileDescriptor(fd as Integer, closeOnDealloc as boolean) as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
You can create a file handle for a socket by using the result of a socket call as fileDescriptor.
The object creating a file handle using this method owns fileDescriptor and is responsible for its disposition.
closeOnDealloc: True if the file descriptor should be closed when the receiver is deallocated, otherwise false.
See also:
NSFileHandleMBS.fileHandleWithNullDevice as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
You can use null-device file handles as "placeholders" for standard-device file handles or in collection objects to avoid exceptions and other errors resulting from messages being sent to invalid file handles. Read messages sent to a null-device file handle return an end-of-file indicator (an empty NSData object) rather than raise an exception. Write messages are no-ops, whereas fileDescriptor returns an illegal value. Other methods are no-ops or return "sensible" values.
NSFileHandleMBS.fileHandleWithStandardError as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Conventionally this is a terminal device to which error messages are sent. There is one standard error file handle per process; it is a shared instance.
NSFileHandleMBS.fileHandleWithStandardInput as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Conventionally this is a terminal device on which the user enters a stream of data. There is one standard input file handle per process; it is a shared instance.
NSFileHandleMBS.fileHandleWithStandardOutput as NSFileHandleMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Conventionally this is a terminal device that receives a stream of data from a program. There is one standard output file handle per process; it is a shared instance.
NSFileHandleMBS.NSFileHandleConnectionAcceptedNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
To cause the posting of this notification, you must send either acceptConnectionInBackgroundAndNotify to an NSFileHandle object representing a server stream-type socket.
The notification object is the NSFileHandle object that sent the notification. The userInfo dictionary contains the following information:
NSFileHandleNotificationFileHandleItem | The NSFileHandle object representing the "near" end of a socket connection |
NSFileHandleError | An integer representing the UNIX-type error which occurred |
NSFileHandleMBS.NSFileHandleDataAvailableNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The observers can then issue the appropriate messages to begin reading the data. To cause the posting of this notification, you must send either waitForDataInBackgroundAndNotify or waitForDataInBackgroundAndNotifyForModes: to an appropriate NSFileHandle object.
The notification object is the NSFileHandle object that sent the notification. This notification does not contain a userInfo dictionary.
NSFileHandleMBS.NSFileHandleNotificationDataItem as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The corresponding value is an memoryblock containing the available data read from a socket connection.
Some examples using this method:
NSFileHandleMBS.NSFileHandleNotificationFileHandleItem as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The corresponding value is the NSFileHandle object handle representing the "near" end of a socket connection.
NSFileHandleMBS.NSFileHandleNotificationMonitorModes as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSFileHandleMBS.NSFileHandleOperationException as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Raised by NSFileHandle if attempts to determine file-handle type fail or if attempts to read from a file or channel fail.
NSFileHandleMBS.NSFileHandleReadCompletionNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This notification is posted when the background thread reads the data currently available in a file or at a communications channel. It makes the data available to observers by putting it in the userInfo dictionary. To cause the posting of this notification, you must send either readInBackgroundAndNotify to an appropriate NSFileHandle object.
The notification object is the NSFileHandle object that sent the notification. The userInfo dictionary contains the following information:
NSFileHandleNotificationDataItem | An string containing the available data read from a socket connection |
NSFileHandleError | An integer representing the UNIX-type error which occurred |
Some examples using this method:
NSFileHandleMBS.NSFileHandleReadToEndOfFileCompletionNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
It makes the data available to observers by putting it in the userInfo dictionary. To cause the posting of this notification, you must send either readToEndOfFileInBackgroundAndNotify to an appropriate NSFileHandle object.
The notification object is the NSFileHandle object that sent the notification. The userInfo dictionary contains the following information:
NSFileHandleNotificationDataItem: A string containing the available data read from a socket connection
NSFileHandleError | An integer representing the UNIX-type error which occurred |
Some examples using this method:
The items on this page are in the following plugins: MBS MacCocoa Plugin.