GetObjectResponseDeserializer.cs 980 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (C) Alibaba Cloud Computing
  3. * All rights reserved.
  4. *
  5. * 版权所有 (C)阿里云计算有限公司
  6. */
  7. using Aliyun.OSS.Common.Communication;
  8. namespace Aliyun.OSS.Transform
  9. {
  10. internal class GetObjectResponseDeserializer : ResponseDeserializer<OssObject, OssObject>
  11. {
  12. private readonly GetObjectRequest _getObjectRequest;
  13. public GetObjectResponseDeserializer(GetObjectRequest getObjectRequest)
  14. : base(null)
  15. {
  16. _getObjectRequest = getObjectRequest;
  17. }
  18. public override OssObject Deserialize(ServiceResponse xmlStream)
  19. {
  20. return new OssObject(_getObjectRequest.Key)
  21. {
  22. BucketName = _getObjectRequest.BucketName,
  23. Content = xmlStream.Content,
  24. Metadata = DeserializerFactory.GetFactory()
  25. .CreateGetObjectMetadataResultDeserializer().Deserialize(xmlStream)
  26. };
  27. }
  28. }
  29. }