LimitedInputStream.cs 886 B

123456789101112131415161718192021222324252627282930313233343536
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System.IO;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1
  6. {
  7. internal abstract class LimitedInputStream
  8. : BaseInputStream
  9. {
  10. protected readonly Stream _in;
  11. private int _limit;
  12. internal LimitedInputStream(Stream inStream, int limit)
  13. {
  14. this._in = inStream;
  15. this._limit = limit;
  16. }
  17. internal virtual int Limit
  18. {
  19. get { return _limit; }
  20. }
  21. protected virtual void SetParentEofDetect(bool on)
  22. {
  23. if (_in is IndefiniteLengthInputStream)
  24. {
  25. ((IndefiniteLengthInputStream)_in).SetEofOn00(on);
  26. }
  27. }
  28. }
  29. }
  30. #pragma warning restore
  31. #endif