mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-10-02 19:58:45 +00:00
add writable checks
This commit is contained in:
@@ -31,6 +31,18 @@ internal static class StreamValidationExtensions
|
||||
return stream;
|
||||
}
|
||||
|
||||
internal static Stream RequireWritable(this Stream stream)
|
||||
{
|
||||
stream.NotNull(nameof(stream));
|
||||
|
||||
if (!stream.CanWrite)
|
||||
{
|
||||
throw new ArgumentException("Stream must be writable", nameof(stream));
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
internal static IReadOnlyList<Stream> RequireSeekable(this IReadOnlyList<Stream> streams)
|
||||
{
|
||||
streams.NotNull(nameof(streams));
|
||||
|
||||
Reference in New Issue
Block a user