1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- //
- // VICacheConfiguration.h
- // VIMediaCacheDemo
- //
- // Created by Vito on 4/21/16.
- // Copyright © 2016 Vito. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- #import "VIContentInfo.h"
- @interface VICacheConfiguration : NSObject <NSCopying>
- + (NSString *)configurationFilePathForFilePath:(NSString *)filePath;
- + (instancetype)configurationWithFilePath:(NSString *)filePath;
- @property (nonatomic, copy, readonly) NSString *filePath;
- @property (nonatomic, strong) VIContentInfo *contentInfo;
- @property (nonatomic, strong) NSURL *url;
- - (NSArray<NSValue *> *)cacheFragments;
- /**
- * cached progress
- */
- @property (nonatomic, readonly) float progress;
- @property (nonatomic, readonly) long long downloadedBytes;
- @property (nonatomic, readonly) float downloadSpeed; // kb/s
- #pragma mark - update API
- - (void)save;
- - (void)addCacheFragment:(NSRange)fragment;
- /**
- * Record the download speed
- */
- - (void)addDownloadedBytes:(long long)bytes spent:(NSTimeInterval)time;
- @end
- @interface VICacheConfiguration (VIConvenient)
- + (BOOL)createAndSaveDownloadedConfigurationForURL:(NSURL *)url error:(NSError **)error;
- @end
|