mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-22 23:15:20 +00:00
Issue 771, remove throw on flush for readonly streams
This commit is contained in:
@@ -17,7 +17,7 @@ internal sealed class RarCryptoWrapper : Stream
|
||||
_rijndael = new BlockTransformer(key.Transformer(salt));
|
||||
}
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException();
|
||||
|
||||
|
||||
@@ -1393,7 +1393,7 @@ internal class ArchiveReader
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.IO;
|
||||
|
||||
@@ -47,7 +47,7 @@ internal class TarReadOnlySubStream : NonDisposingStream
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Common.Zip;
|
||||
@@ -87,10 +87,7 @@ internal class PkwareTraditionalCryptoStream : Stream
|
||||
_stream.Write(encrypted, 0, encrypted.Length);
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
//throw new NotSupportedException();
|
||||
}
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException();
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ internal class WinzipAesCryptoStream : Stream
|
||||
}
|
||||
}
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Filters;
|
||||
@@ -79,7 +79,7 @@ internal class BCJ2Filter : Stream
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length => _baseStream.Length + _data1.Length + _data2.Length;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Filters;
|
||||
@@ -40,7 +40,7 @@ internal abstract class Filter : Stream
|
||||
|
||||
public override bool CanWrite => _isEncoder;
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length => _baseStream.Length;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.Common.SevenZip;
|
||||
using SharpCompress.Compressors.LZMA.Utilites;
|
||||
@@ -14,7 +14,7 @@ internal abstract class DecoderStream2 : Stream
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ internal sealed class MultiVolumeReadOnlyStream : Stream
|
||||
|
||||
public byte[] CurrentCrc { get; private set; }
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -23,7 +23,7 @@ public abstract class ReadOnlyStream : Stream
|
||||
set => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.IO;
|
||||
@@ -26,7 +26,7 @@ internal class BufferedSubStream : NonDisposingStream
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length => BytesLeftToRead;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DataDescriptorStream : Stream
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length => _stream.Length;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ internal class ReadOnlySubStream : NonDisposingStream
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public class RewindableStream : Stream
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length => stream.Length;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Test.Mocks;
|
||||
@@ -27,7 +27,7 @@ public class FlushOnDisposeStream : Stream, IDisposable
|
||||
set => inner.Position = value;
|
||||
}
|
||||
|
||||
public override void Flush() => throw new NotImplementedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count) =>
|
||||
inner.Read(buffer, offset, count);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Test.Mocks;
|
||||
@@ -29,7 +29,7 @@ public class ForwardOnlyStream : Stream
|
||||
public override bool CanSeek => false;
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush() => throw new NotSupportedException();
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user