ResponseDeserializer.cs 946 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (C) Alibaba Cloud Computing
  3. * All rights reserved.
  4. *
  5. * 版权所有 (C)阿里云计算有限公司
  6. */
  7. using System.IO;
  8. using Aliyun.OSS.Util;
  9. using Aliyun.OSS.Common.Communication;
  10. namespace Aliyun.OSS.Transform
  11. {
  12. internal abstract class ResponseDeserializer<TResult, TModel> : IDeserializer<ServiceResponse, TResult>
  13. {
  14. protected IDeserializer<Stream, TModel> ContentDeserializer { get; private set; }
  15. public ResponseDeserializer(IDeserializer<Stream, TModel> contentDeserializer)
  16. {
  17. ContentDeserializer = contentDeserializer;
  18. }
  19. public abstract TResult Deserialize(ServiceResponse xmlStream);
  20. protected string Decode(string value, string decodeType)
  21. {
  22. if (decodeType.Equals(HttpUtils.UrlEncodingType))
  23. {
  24. return HttpUtils.DecodeUri(value);
  25. }
  26. return value;
  27. }
  28. }
  29. }