ReadOnlyStream.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.IO;
  3. namespace SharpCompress.Compressors.Xz
  4. {
  5. public abstract class ReadOnlyStream : Stream
  6. {
  7. public Stream BaseStream { get; protected set; }
  8. public override bool CanRead => BaseStream.CanRead;
  9. public override bool CanSeek => false;
  10. public override bool CanWrite => false;
  11. public override long Length => throw new NotSupportedException();
  12. public override long Position
  13. {
  14. get => throw new NotSupportedException();
  15. set => throw new NotSupportedException();
  16. }
  17. public override void Flush()
  18. {
  19. throw new NotSupportedException();
  20. }
  21. public override long Seek(long offset, SeekOrigin origin)
  22. {
  23. throw new NotSupportedException();
  24. }
  25. public override void SetLength(long value)
  26. {
  27. throw new NotSupportedException();
  28. }
  29. public override void Write(byte[] buffer, int offset, int count)
  30. {
  31. throw new NotSupportedException();
  32. }
  33. }
  34. }