public abstract class LynxGenericResourceFetcher { /** * fetch resource with contents. * * @param request * @param callback contents of the requiring resource. */ public abstract void fetchResource( LynxResourceRequest request, LynxResourceCallback<byte[]> callback); /** * fetch resource with res path. * * @param request * @param callback path on the disk of the requiring resource. */ public abstract void fetchResourcePath( LynxResourceRequest request, LynxResourceCallback<String> callback); /** * fetch resource with stream. * * @param request * @param delegate streaming of the requiring resource. */ public void fetchStream(LynxResourceRequest request, StreamDelegate delegate){}; /** * cancel the request of the requiring resource. * * @param request the requiring request. */ public void cancel(LynxResourceRequest request){};}
@protocol LynxGenericResourceFetcher <NSObject>/** * fetch resource with contents. * * @param request. * @param callback contents of the requiring resource. * * @return: A block which can cancel the image request if it is not finished. nil if cancel action * is not supported. */@required- (dispatch_block_t)fetchResource:(nonnull LynxResourceRequest *)request onComplete:(LynxGenericResourceCompletionBlock _Nonnull)callback;/** * fetch resource with res path. * * @param request * @param callback path on the disk of the requiring resource. * * @return: A block which can cancel the image request if it is not finished. nil if cancel action * is not supported. */@required- (dispatch_block_t)fetchResourcePath:(nonnull LynxResourceRequest *)request onComplete:(LynxGenericResourcePathCompletionBlock _Nonnull)callback;/** * fetch resource with stream. * * @param request * @param delegate streaming of the requiring resource. * * @return: A block which can cancel the image request if it is not finished. nil if cancel action * is not supported. */@optional- (dispatch_block_t)fetchStream:(nonnull LynxResourceRequest *)request withStream:(nonnull id<LynxResourceStreamLoadDelegate>)delegate;@end