LynxGenericResourceFetcher is defined inside LynxEngine and injected from outside to implement a general resource loading interface. It is used inside LynxEngine for resource loading capabilities of components such as Text;
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){};}
LynxEngine internally calls this method to obtain the general resource content, and the return result is required to be the resource content byte[] type;
LynxEngine internally calls this method to obtain the path of the common resource on the local disk, and the return result is required to be of String type;
@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
LynxEngine internally calls this method to obtain the general resource content, and the return result is required to be the resource content byte[] type;
LynxEngine internally calls this method to obtain the path of the common resource on the local disk, and the return result is required to be of String type;
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.