HeadObjectResult.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace COSXML.Model.Object
  5. {
  6. /// <summary>
  7. /// 检索对象返回的结果
  8. /// <see href="https://cloud.tencent.com/document/product/436/7745"/>
  9. /// </summary>
  10. public sealed class HeadObjectResult : CosResult
  11. {
  12. /// <summary>
  13. /// Object 的存储级别,枚举值:STANDARD,STANDARD_IA
  14. /// <see href="Common.CosStorageClass"/>
  15. /// </summary>
  16. public string cosStorageClass;
  17. /// <summary>
  18. /// 对象的长度
  19. /// </summary>
  20. public long size;
  21. /// <summary>
  22. /// 对象的eTag
  23. /// </summary>
  24. public string eTag;
  25. /// <summary>
  26. /// 对象的 crc64ecma
  27. /// </summary>
  28. public string crc64ecma;
  29. /// <summary>
  30. /// 对象的 lastModified
  31. /// </summary>
  32. public string lastModified;
  33. internal override void InternalParseResponseHeaders()
  34. {
  35. List<string> values;
  36. this.responseHeaders.TryGetValue("x-cos-storage-class", out values);
  37. if (values != null && values.Count > 0)
  38. {
  39. cosStorageClass = values[0];
  40. }
  41. this.responseHeaders.TryGetValue("Content-Length", out values);
  42. if (values != null && values.Count > 0)
  43. {
  44. long.TryParse(values[0], out size);
  45. }
  46. this.responseHeaders.TryGetValue("ETag", out values);
  47. if (values != null && values.Count > 0)
  48. {
  49. eTag = values[0];
  50. }
  51. this.responseHeaders.TryGetValue("x-cos-hash-crc64ecma", out values);
  52. if (values != null && values.Count > 0)
  53. {
  54. crc64ecma = values[0];
  55. }
  56. this.responseHeaders.TryGetValue("Last-Modified", out values);
  57. if (values != null && values.Count > 0)
  58. {
  59. lastModified = values[0];
  60. }
  61. }
  62. }
  63. }