MBFileWriteOperation Class Reference
| Inherits from | NSOperation |
|---|---|
| Declared in | MBFilesystemOperations.h |
Overview
An NSOperation subclass that can be used to write data to a file.
MBFileWriteOperation instances are added to NSOperationQueues to be
performed.
The MBFilesystemOperationQueue singleton is available as a convenience
for performing filesystem operations such as this.
Note: This operation does not provide a mechanism to be notified of its success or failure.
Object lifecycle
+ operationForWritingData:toFile:
Creates a new MBFileWriteOperation instance that can be used to write
data to a file.
+ (nonnull instancetype)operationForWritingData:(nullable NSData *)data toFile:(nonnull NSString *)pathParameters
data |
The data to be written to the file. Passing |
|---|---|
path |
The filesystem path of the file to be written by the returned operation. |
Return Value
The newly-created MBFileWriteOperation instance.
Declared In
MBFilesystemOperations.h
– initWithData:forFilePath:
Initializes the receiver so it can be used to write to the specified file.
- (nonnull instancetype)initWithData:(nullable NSData *)data forFilePath:(nonnull NSString *)pathParameters
data |
The data to be written to the file. Passing |
|---|---|
path |
The filesystem path of the file to be written. |
Return Value
The receiver.
Declared In
MBFilesystemOperations.h
Getting information about the operation
filePath
Returns the filesystem path of the file to be written by the operation.
@property (nonnull, nonatomic, readonly) NSString *filePathDeclared In
MBFilesystemOperations.h
fileData
Returns the data that will be written to the file by the operation.
@property (nonnull, nonatomic, readonly) NSData *fileDataDeclared In
MBFilesystemOperations.h
Subclassing hooks
– dataForOperation
Returns the data that will be written to the file.
- (nonnull NSData *)dataForOperationReturn Value
The data to write to the file.
Discussion
The default implementation returns the NSData instance used when the
receiver was initialized. Subclasses may override this to provide an
alternate mechanism for supplying the data to be written.
Declared In
MBFilesystemOperations.h