public class NSFileHandle extends NSObject
Constructor and Description |
---|
NSFileHandle(int fd)
Creates a NSFileHandle object for the specified file descriptor.
|
NSFileHandle(int fd,
boolean closeopt)
Creates a NSFileHandle object for the specified file descriptor with the
option of controlling the closing of it.
|
Modifier and Type | Method and Description |
---|---|
void |
acceptConnectionInBackgroundAndNotify()
Accepts a socket connection in the background.
|
void |
acceptConnectionInBackgroundAndNotifyForModes(List modes)
Accepts a socket connection in the background.
|
NSData |
availableData()
Returns the current data of this NSFileHandle.
|
void |
closeFile()
Changes the permissions of the file of this NSFileHandle to readonly.
|
int |
fileDescriptor()
Returns the file descriptor of this NSFileHandle.
|
static NSFileHandle |
fileHandleForReadingAtPath(String path)
Returns a NSFileHandle used for reading the data of the object at the
specified path.
|
static NSFileHandle |
fileHandleForReadingFromURL(NSURL url,
crossmobile.rt.StrongReference<NSError> error)
Returns a NSFileHandle used for reading the data of the object at the
specified URL.
|
static NSFileHandle |
fileHandleForUpdatingAtPath(String path)
Returns a NSFileHandle used for reading and writing the data of the
object at the specified path.
|
static NSFileHandle |
fileHandleForUpdatingURL(NSURL url,
crossmobile.rt.StrongReference<NSError> error)
Returns a NSFileHandle used for reading and writing the data of the
object at the specified URL.
|
static NSFileHandle |
fileHandleForWritingAtPath(String path)
Returns a NSFileHandle used for writing the data of the object at the
specified path.
|
static NSFileHandle |
fileHandleForWritingToURL(NSURL url,
crossmobile.rt.StrongReference<NSError> error)
Returns a NSFileHandle used for writing the data of the object at the
specified URL.
|
static NSFileHandle |
fileHandleWithNullDevice()
Returns the NSFileHandle of the null device.
|
static NSFileHandle |
fileHandleWithStandardError()
Returns the NSFileHandle of the standard error file.
|
static NSFileHandle |
fileHandleWithStandardInput()
Returns the NSFileHandle of the standard input file.
|
static NSFileHandle |
fileHandleWithStandardOutput()
Returns the NSFileHandle of the standard output file.
|
long |
offsetInFile()
Returns the file pointer's position for the file of this NSFileHandle.
|
NSData |
readDataOfLength(int length)
Reads the specified length of data of this NSFileHandle.
|
NSData |
readDataToEndOfFile()
Reads the data of this NSFileHandle Synchronously reads the available
data up to the end of file or maximum number of bytes.
|
void |
readInBackgroundAndNotify()
Reads the file of this NSFileHandle in the background and notifies when
it ends.
|
void |
readInBackgroundAndNotifyForModes(List modes)
Reads the file of this NSFileHandle in the background and notifies when
it ends.
|
void |
readToEndOfFileInBackgroundAndNotify()
Reads the file of this NSFileHandle to the end, in the background and
notifies when it ends.
|
void |
readToEndOfFileInBackgroundAndNotifyForModes(List modes)
Reads the file of this NSFileHandle to the end, in the background and
notifies when it ends.
|
long |
seekToEndOfFile()
Places the file pointer at the end of the file for this NSFileHandle.
|
void |
seekToFileOffset(long offset)
Places the file pointer at the specified offset of the file for this
NSFileHandle.
|
void |
synchronizeFile()
Stores permanently all the data of the file of this NSFileHandle.
|
void |
truncateFileAtOffset(long offset)
Trims or extends the file of this NSFileHandle according to the specified
offset.
|
void |
waitForDataInBackgroundAndNotify()
Checks asynchronously if data is available.
|
void |
waitForDataInBackgroundAndNotifyForModes(List modes)
Checks whether data is available.
|
void |
writeData(NSData data)
Writes the specified data to this NSFileHandler.
|
addObserver, observeValueForKeyPath, performSelector, performSelectorOnMainThread, release, removeObserver, removeObserver, retain, setValueForKey, setValueForUndefinedKey, valueForKey, valueForUndefinedKey
public NSFileHandle(int fd, boolean closeopt)
fd
- The file descriptor of the NSFileHandle.closeopt
- TRUE, then the NSFileHandle is responsible for closing
it.public NSFileHandle(int fd)
fd
- The file descriptor of the NSFileHandle.public static NSFileHandle fileHandleWithStandardInput()
public static NSFileHandle fileHandleWithStandardOutput()
public static NSFileHandle fileHandleWithStandardError()
public static NSFileHandle fileHandleWithNullDevice()
public static NSFileHandle fileHandleForReadingAtPath(String path)
path
- The path of the data object.public static NSFileHandle fileHandleForWritingAtPath(String path)
path
- The path of the data object.public static NSFileHandle fileHandleForUpdatingAtPath(String path)
path
- The path of the data object.public static NSFileHandle fileHandleForReadingFromURL(NSURL url, crossmobile.rt.StrongReference<NSError> error)
url
- The URL of the data object.error
- The error returned in case of failure.public static NSFileHandle fileHandleForWritingToURL(NSURL url, crossmobile.rt.StrongReference<NSError> error)
url
- The URL of the data object.error
- The error returned in case of failure.public static NSFileHandle fileHandleForUpdatingURL(NSURL url, crossmobile.rt.StrongReference<NSError> error)
url
- The URL of the data object.error
- The error returned in case of failure.public NSData availableData()
public NSData readDataToEndOfFile()
public NSData readDataOfLength(int length)
length
- The number of bytes to read.public void writeData(NSData data)
data
- The data to be written.public long offsetInFile()
public long seekToEndOfFile()
public void seekToFileOffset(long offset)
offset
- The offset of the file.public void truncateFileAtOffset(long offset)
offset
- The offset that specifies the new end of file.public void synchronizeFile()
public void closeFile()
public void readInBackgroundAndNotifyForModes(List modes)
modes
- The modes of the runloop in which the notification of the
read completion can be posted.public void readInBackgroundAndNotify()
public void readToEndOfFileInBackgroundAndNotifyForModes(List modes)
modes
- The modes of the runloop in which the notification of the
read completion can be posted.public void readToEndOfFileInBackgroundAndNotify()
public void acceptConnectionInBackgroundAndNotifyForModes(List modes)
modes
- The modes of the runloop in which the notification of the
connection acceptance notification can be posted.public void acceptConnectionInBackgroundAndNotify()
public void waitForDataInBackgroundAndNotifyForModes(List modes)
modes
- The modes of the runloop in which the notification data
availability can be posted.public void waitForDataInBackgroundAndNotify()
public int fileDescriptor()
Copyright © 2020. All rights reserved.