InitiateMultipartUploadResultDeserializer.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (C) Alibaba Cloud Computing
  3. * All rights reserved.
  4. *
  5. * 版权所有 (C)阿里云计算有限公司
  6. */
  7. using System.IO;
  8. using Aliyun.OSS.Common.Communication;
  9. using Aliyun.OSS.Model;
  10. namespace Aliyun.OSS.Transform
  11. {
  12. internal class InitiateMultipartUploadResultDeserializer
  13. : ResponseDeserializer<InitiateMultipartUploadResult, InitiateMultipartResult>
  14. {
  15. public InitiateMultipartUploadResultDeserializer(IDeserializer<Stream, InitiateMultipartResult> contentDeserializer)
  16. : base(contentDeserializer)
  17. { }
  18. public override InitiateMultipartUploadResult Deserialize(ServiceResponse xmlStream)
  19. {
  20. var result = ContentDeserializer.Deserialize(xmlStream.Content);
  21. string encodeType = result.EncodingType == null ?
  22. string.Empty : result.EncodingType.ToLowerInvariant();
  23. return new InitiateMultipartUploadResult
  24. {
  25. BucketName = result.Bucket,
  26. Key = Decode(result.Key, encodeType),
  27. UploadId = result.UploadId
  28. };
  29. }
  30. }
  31. }