Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 771, remove throw on flush for readonly streams #801

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SharpCompress/Common/Rar/RarCryptoWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public RarCryptoWrapper(Stream actualStream, byte[] salt, ICryptKey key)
_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();

Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Common/SevenZip/ArchiveReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ public FolderUnpackStream(ArchiveDatabase db, int p, int startIndex, List<bool>

public override bool CanWrite => false;

public override void Flush() => throw new NotSupportedException();
public override void Flush() { }

public override long Length => throw new NotSupportedException();

Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Common/Tar/TarReadOnlySubStream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using SharpCompress.IO;

Expand Down Expand Up @@ -47,7 +47,7 @@ protected override void Dispose(bool disposing)

public override bool CanWrite => false;

public override void Flush() => throw new NotSupportedException();
public override void Flush() { }

public override long Length => throw new NotSupportedException();

Expand Down
7 changes: 2 additions & 5 deletions src/SharpCompress/Common/Zip/PkwareTraditionalCryptoStream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;

namespace SharpCompress.Common.Zip;
Expand Down Expand Up @@ -87,10 +87,7 @@ public override void Write(byte[] buffer, int offset, int count)
_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();

Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Common/Zip/WinzipAesCryptoStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected override void Dispose(bool disposing)
}
}

public override void Flush() => throw new NotSupportedException();
public override void Flush() { }

public override int Read(byte[] buffer, int offset, int count)
{
Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Compressors/Filters/BCJ2Filter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;

namespace SharpCompress.Compressors.Filters;
Expand Down Expand Up @@ -79,7 +79,7 @@ protected override void Dispose(bool disposing)

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;

Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Compressors/Filters/Filter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;

namespace SharpCompress.Compressors.Filters;
Expand Down Expand Up @@ -40,7 +40,7 @@ protected override void Dispose(bool disposing)

public override bool CanWrite => _isEncoder;

public override void Flush() => throw new NotSupportedException();
public override void Flush() { }

public override long Length => _baseStream.Length;

Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Compressors/LZMA/DecoderStream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using SharpCompress.Common.SevenZip;
using SharpCompress.Compressors.LZMA.Utilites;
Expand All @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public override int Read(byte[] buffer, int offset, int count)

public byte[] CurrentCrc { get; private set; }

public override void Flush() => throw new NotSupportedException();
public override void Flush() { }

public override long Length => throw new NotSupportedException();

Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Compressors/Xz/ReadOnlyStream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable disable
#nullable disable

using System;
using System.IO;
Expand All @@ -23,7 +23,7 @@ public override long Position
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();

Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/IO/BufferedSubStream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;

namespace SharpCompress.IO;
Expand Down Expand Up @@ -26,7 +26,7 @@ public BufferedSubStream(Stream stream, long origin, long bytesToRead)

public override bool CanWrite => false;

public override void Flush() => throw new NotSupportedException();
public override void Flush() { }

public override long Length => BytesLeftToRead;

Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/IO/DataDescriptorStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected override void Dispose(bool disposing)

public override bool CanWrite => false;

public override void Flush() => throw new NotSupportedException();
public override void Flush() { }

public override long Length => _stream.Length;

Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/IO/ReadOnlySubStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ReadOnlySubStream(Stream stream, long? origin, long bytesToRead)

public override bool CanWrite => false;

public override void Flush() => throw new NotSupportedException();
public override void Flush() { }

public override long Length => throw new NotSupportedException();

Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/IO/RewindableStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void StartRecording()

public override bool CanWrite => false;

public override void Flush() => throw new NotSupportedException();
public override void Flush() { }

public override long Length => stream.Length;

Expand Down
4 changes: 2 additions & 2 deletions tests/SharpCompress.Test/Mocks/FlushOnDisposeStream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;

namespace SharpCompress.Test.Mocks;
Expand Down Expand Up @@ -27,7 +27,7 @@ public override long Position
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);
Expand Down
4 changes: 2 additions & 2 deletions tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;

namespace SharpCompress.Test.Mocks;
Expand Down Expand Up @@ -29,7 +29,7 @@ protected override void Dispose(bool disposing)
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();

Expand Down