aliyun-oss-react-native

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // OSSUtil.h
  3. // oss_ios_sdk
  4. //
  5. // Created by zhouzhuo on 8/16/15.
  6. // Copyright (c) 2015 aliyun.com. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "OSSFileLogger.h"
  10. @class OSSFederationToken;
  11. @interface OSSUtil : NSObject
  12. + (NSString *)calBase64Sha1WithData:(NSString *)data withSecret:(NSString *)key;
  13. + (NSString *)calBase64WithData:(uint8_t *)data;
  14. + (NSString *)encodeURL:(NSString *)url;
  15. + (NSData *)constructHttpBodyFromPartInfos:(NSArray *)partInfos;
  16. + (NSData *)constructHttpBodyForDeleteMultipleObjects:(NSArray<NSString *> *)keys quiet:(BOOL)quiet;
  17. + (NSData *)constructHttpBodyForCreateBucketWithLocation:(NSString *)location __attribute__((deprecated("deprecated!")));
  18. + (BOOL)validateBucketName:(NSString *)bucketName;
  19. + (BOOL)validateObjectKey:(NSString *)objectKey;
  20. + (BOOL)isOssOriginBucketHost:(NSString *)host;
  21. + (NSString *)getIpByHost:(NSString *)host;
  22. + (BOOL)isNetworkDelegateState;
  23. + (NSData *)fileMD5:(NSString *)path;
  24. + (NSString *)dataMD5String:(NSData *)data;
  25. + (NSString *)fileMD5String:(NSString *)path;
  26. + (NSString *)base64Md5ForData:(NSData *)data;
  27. + (NSString *)base64Md5ForFilePath:(NSString *)filePath;
  28. + (NSString *)base64Md5ForFileURL:(NSURL *)fileURL;
  29. + (NSString *)base64ForData:(uint8_t *)input length:(int32_t)length;
  30. + (NSString *)populateSubresourceStringFromParameter:(NSDictionary *)parameters;
  31. + (NSString *)populateQueryStringFromParameter:(NSDictionary *)parameters;
  32. + (BOOL)isSubresource:(NSString *)param;
  33. + (NSString *)sign:(NSString *)content withToken:(OSSFederationToken *)token;
  34. + (NSString *)getRelativePath:(NSString *)fullPath;
  35. + (NSString *)detemineMimeTypeForFilePath:(NSString *)filePath uploadName:(NSString *)uploadName;
  36. + (BOOL)hasPhoneFreeSpace;
  37. + (NSString*)buildNetWorkConnectedMsg;
  38. + (NSString*)buildOperatorMsg;
  39. + (uint64_t)crc64ecma:(uint64_t)crc1 buffer:(void *)buffer length:(size_t)len;
  40. /**
  41. * @brief: combine crc1 and crc2
  42. */
  43. + (uint64_t)crc64ForCombineCRC1:(uint64_t)crc1 CRC2:(uint64_t)crc2 length:(size_t)len2;
  44. + (NSString *)sha1WithString:(NSString *)string;
  45. + (NSString *)sha1WithData:(NSData *)data;
  46. + (NSString *)sha1WithFilePath:(NSString *)filePath;
  47. + (NSData *)constructHttpBodyForTriggerCallback:(NSString *)callbackParams callbackVaribles:(NSString *)callbackVaribles;
  48. + (NSData *)constructHttpBodyForImagePersist:(NSString *)action toBucket:(NSString *)toBucket toObjectKey:(NSString *)toObjectKey;
  49. @end
  50. @interface NSString (OSS)
  51. - (NSString *)oss_trim;
  52. - (BOOL)oss_isNotEmpty;
  53. - (NSString *)oss_stringByAppendingPathComponentForURL:(NSString *)path;
  54. + (NSString *)oss_documentDirectory;
  55. @end