洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.7 KiB

8 months ago
  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. #import "NSMutableDictionary+OSS.h"
  11. #import "NSMutableData+OSS_CRC.h"
  12. #import "NSDate+OSS.h"
  13. @class OSSFederationToken;
  14. @interface OSSUtil : NSObject
  15. + (BOOL)isIncludeCnameExcludeList:(NSArray *)cnameExcludeList host:(NSString *)host;
  16. + (NSString *)calBase64Sha1WithData:(NSString *)data withSecret:(NSString *)key;
  17. + (NSString *)calBase64WithData:(uint8_t *)data;
  18. + (NSString *)encodeURL:(NSString *)url;
  19. + (NSData *)constructHttpBodyForDeleteMultipleObjects:(NSArray<NSString *> *)keys quiet:(BOOL)quiet;
  20. + (NSData *)constructHttpBodyForCreateBucketWithLocation:(NSString *)location __attribute__((deprecated("deprecated!")));
  21. + (BOOL)validateBucketName:(NSString *)bucketName;
  22. + (BOOL)validateObjectKey:(NSString *)objectKey;
  23. + (BOOL)isOssOriginBucketHost:(NSString *)host;
  24. + (BOOL)isNetworkDelegateState;
  25. + (NSData *)fileMD5:(NSString *)path;
  26. + (NSString *)dataMD5String:(NSData *)data;
  27. + (NSString *)fileMD5String:(NSString *)path;
  28. + (NSString *)base64Md5ForData:(NSData *)data;
  29. + (NSString *)base64Md5ForFilePath:(NSString *)filePath;
  30. + (NSString *)base64Md5ForFileURL:(NSURL *)fileURL;
  31. + (NSString *)base64ForData:(uint8_t *)input length:(int32_t)length;
  32. + (NSString *)populateSubresourceStringFromParameter:(NSDictionary *)parameters;
  33. + (NSString *)populateQueryStringFromParameter:(NSDictionary *)parameters;
  34. + (BOOL)isSubresource:(NSString *)param;
  35. + (NSString *)sign:(NSString *)content withToken:(OSSFederationToken *)token;
  36. + (NSString *)getRelativePath:(NSString *)fullPath;
  37. + (NSString *)detemineMimeTypeForFilePath:(NSString *)filePath uploadName:(NSString *)uploadName;
  38. + (BOOL)hasPhoneFreeSpace;
  39. + (NSString*)buildNetWorkConnectedMsg;
  40. + (NSString*)buildOperatorMsg;
  41. + (uint64_t)crc64ecma:(uint64_t)crc1 buffer:(void *)buffer length:(size_t)len;
  42. /**
  43. * @brief: combine crc1 and crc2
  44. */
  45. + (uint64_t)crc64ForCombineCRC1:(uint64_t)crc1 CRC2:(uint64_t)crc2 length:(size_t)len2;
  46. + (NSString *)sha1WithString:(NSString *)string;
  47. + (NSString *)sha1WithData:(NSData *)data;
  48. + (NSString *)sha1WithFilePath:(NSString *)filePath;
  49. + (NSData *)constructHttpBodyForTriggerCallback:(NSString *)callbackParams callbackVaribles:(NSString *)callbackVaribles;
  50. + (NSData *)constructHttpBodyForImagePersist:(NSString *)action toBucket:(NSString *)toBucket toObjectKey:(NSString *)toObjectKey;
  51. @end
  52. @interface NSString (OSS)
  53. - (NSString *)oss_trim;
  54. - (BOOL)oss_isNotEmpty;
  55. - (NSString *)oss_stringByAppendingPathComponentForURL:(NSString *)path;
  56. + (NSString *)oss_documentDirectory;
  57. - (NSString *)oss_urlEncodedString;
  58. @end