KiiRTransfer Protocol Reference
Conforms to | NSObject |
Declared in | KiiRTransfer.h |
Overview
Protocol to encapsulate Resumable transfer process. Resumable transfer process consist of Download and Upload.
Tasks
Resumable transfer process
-
– info
required method -
– transferWithProgressBlock:andError:
required method -
– transferWithProgressBlock:andCompletionBlock:
required method -
– suspend:
required method -
– terminate:
required method -
– fileHolder
required method
Instance Methods
fileHolder
Get the File Holder instance which this transfer is bounded.
- (nullable id<FileHolder>)fileHolder
Return Value
fileHolder a KiiObject instance which this transfer is bounded.
Discussion
Get the File Holder instance which this transfer is bounded.
Declared In
KiiRTransfer.h
info
Synchronously get transfer process information. This is blocking method.
- (nonnull KiiRTransferInfo *)info
Return Value
KiiRTransferInfo an object contains information regarding transfer process.
Discussion
Synchronously get transfer process information. This is blocking method.
Declared In
KiiRTransfer.h
suspend:
Suspend transfer process. Does not blocks until the completion of suspend. Completion of suspend is notified in completion block. If the transfer is on the way of sending a chunk, that chunk will be transferred and progress block is called before suspend notified.
- (BOOL)suspend:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass NULL if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
YES if succeeded, NO otherwise.
Discussion
Suspend transfer process. Does not blocks until the completion of suspend. Completion of suspend is notified in completion block. If the transfer is on the way of sending a chunk, that chunk will be transferred and progress block is called before suspend notified.
Declared In
KiiRTransfer.h
terminate:
Synchronously terminate transfer process. This is blocking method.
- (BOOL)terminate:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass NULL if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
YES if succeeded, NO otherwise.
Discussion
Synchronously terminate transfer process. This is blocking method.
Declared In
KiiRTransfer.h
transferWithProgressBlock:andCompletionBlock:
Asynchronously proceed transfer process using block.
This is non-blocking method.
KiiRTransferBlock is a block defined as: typedef void(^KiiRTransferBlock)(id
- (void)transferWithProgressBlock:(nullable KiiRTransferBlock)progress andCompletionBlock:(nullable KiiRTransferBlock)completion
Parameters
- progress
KiiRTransferBlock block. This can be nil.
- completion
KiiRTransferBlock block to handle after process completed. This can be nil.
Discussion
Asynchronously proceed transfer process using block.
This is non-blocking method.
KiiRTransferBlock is a block defined as: typedef void(^KiiRTransferBlock)(id
[aTransfer transferWithProgressBlock:^(id <KiiRTransfer> transferObject, NSError *error) {
if (nil == error) {
KiiRTransferInfo *info = [transferObject info];
NSLog(@"%d", [info completedSizeInBytes]);
}
} andCompletionBlock:^(id <KiiRTransfer> transferObject, NSError *error) {
if (nil == error) {
NSLog(@"Transfer is completed");
}
}];
Declared In
KiiRTransfer.h
transferWithProgressBlock:andError:
Synchronously proceed transfer process. This is blocking method.
KiiRTransferBlock is a block defined as: typedef void(^KiiRTransferBlock)(id
- (BOOL)transferWithProgressBlock:(nullable KiiRTransferBlock)progress andError:(NSError *_Nullable *_Nullable)error
Parameters
- progress
KiiRTransferBlock block, can be nil.
- error
used to return an error by reference (pass NULL if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
YES if succeeded, NO otherwise.
Discussion
Synchronously proceed transfer process. This is blocking method.
KiiRTransferBlock is a block defined as: typedef void(^KiiRTransferBlock)(id
NSError *error = nil;
[aTransfer transferWithProgressBlock:^(id <KiiRTransfer> transferObject, NSError *error) {
if (nil == error) {
KiiRTransferInfo *info = [transferObject info];
NSLog(@"%d", [info completedSizeInBytes]);
}
} andError:&error];
if (error == nil) {
NSLog(@"Transfer is completed.");
}
Warning: This API access to server. Should not be executed in UI/Main thread.
Declared In
KiiRTransfer.h