mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-24 07:54:39 +00:00
remove IStreamStack from non specialized streams
This commit is contained in:
@@ -8,10 +8,8 @@ using SharpCompress.Readers;
|
||||
|
||||
namespace SharpCompress.Common;
|
||||
|
||||
public partial class EntryStream : Stream, IStreamStack
|
||||
public partial class EntryStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
private readonly IReader _reader;
|
||||
private readonly Stream _stream;
|
||||
private bool _completed;
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Common.Tar;
|
||||
|
||||
internal class TarReadOnlySubStream : Stream, IStreamStack
|
||||
internal class TarReadOnlySubStream : Stream
|
||||
{
|
||||
private readonly Stream _stream;
|
||||
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
private bool _isDisposed;
|
||||
private long _amountRead;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Common.Zip;
|
||||
|
||||
@@ -10,10 +9,8 @@ internal enum CryptoMode
|
||||
Decrypt,
|
||||
}
|
||||
|
||||
internal class PkwareTraditionalCryptoStream : Stream, IStreamStack
|
||||
internal class PkwareTraditionalCryptoStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
private readonly PkwareTraditionalEncryptionData _encryptor;
|
||||
private readonly CryptoMode _mode;
|
||||
private readonly Stream _stream;
|
||||
|
||||
@@ -2,14 +2,11 @@ using System;
|
||||
using System.Buffers.Binary;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Common.Zip;
|
||||
|
||||
internal class WinzipAesCryptoStream : Stream, IStreamStack
|
||||
internal class WinzipAesCryptoStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
private const int BLOCK_SIZE_IN_BYTES = 16;
|
||||
private readonly SymmetricAlgorithm _cipher;
|
||||
private readonly byte[] _counter = new byte[BLOCK_SIZE_IN_BYTES];
|
||||
|
||||
@@ -30,17 +30,14 @@ using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.ADC;
|
||||
|
||||
/// <summary>
|
||||
/// Provides a forward readable only stream that decompresses ADC data
|
||||
/// </summary>
|
||||
public sealed partial class ADCStream : Stream, IStreamStack
|
||||
public sealed partial class ADCStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
/// <summary>
|
||||
/// This stream holds the compressed data
|
||||
/// </summary>
|
||||
|
||||
@@ -4,12 +4,9 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Compressors.RLE90;
|
||||
using SharpCompress.Compressors.Squeezed;
|
||||
using SharpCompress.IO;
|
||||
|
||||
public partial class ArcLzwStream : Stream, IStreamStack
|
||||
public partial class ArcLzwStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
private Stream _stream;
|
||||
private bool _processed;
|
||||
private bool _useCrunched;
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Arj
|
||||
{
|
||||
[CLSCompliant(true)]
|
||||
public sealed partial class LHDecoderStream : Stream, IStreamStack
|
||||
public sealed partial class LHDecoderStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
private readonly BitReader _bitReader;
|
||||
private readonly Stream _stream;
|
||||
|
||||
|
||||
@@ -2,12 +2,11 @@ using System;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Arj
|
||||
{
|
||||
[CLSCompliant(true)]
|
||||
public sealed class LhaStream<C> : Stream, IStreamStack
|
||||
public sealed class LhaStream<C> : Stream
|
||||
where C : ILhaDecoderConfig, new()
|
||||
{
|
||||
private readonly BitReader _bitReader;
|
||||
@@ -26,8 +25,6 @@ namespace SharpCompress.Compressors.Arj
|
||||
private readonly int _originalSize;
|
||||
private int _producedBytes = 0;
|
||||
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
public LhaStream(Stream compressedStream, int originalSize)
|
||||
{
|
||||
_stream = compressedStream ?? throw new ArgumentNullException(nameof(compressedStream));
|
||||
|
||||
@@ -2,14 +2,11 @@ using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.BZip2;
|
||||
|
||||
public sealed partial class BZip2Stream : Stream, IStreamStack
|
||||
public sealed partial class BZip2Stream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => stream;
|
||||
|
||||
private Stream stream = default!;
|
||||
private bool isDisposed;
|
||||
private bool leaveOpen;
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.Buffers;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
/*
|
||||
* Copyright 2001,2004-2005 The Apache Software Foundation
|
||||
@@ -41,10 +40,8 @@ namespace SharpCompress.Compressors.BZip2;
|
||||
* start of the BZIP2 stream to make it compatible with other PGP programs.
|
||||
*/
|
||||
|
||||
internal partial class CBZip2InputStream : Stream, IStreamStack
|
||||
internal partial class CBZip2InputStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => bsStream;
|
||||
|
||||
private static void Cadvise()
|
||||
{
|
||||
//System.out.Println("CRC Error");
|
||||
|
||||
@@ -2,8 +2,6 @@ using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
/*
|
||||
* Copyright 2001,2004-2005 The Apache Software Foundation
|
||||
*
|
||||
@@ -41,10 +39,8 @@ namespace SharpCompress.Compressors.BZip2;
|
||||
* start of the BZIP2 stream to make it compatible with other PGP programs.
|
||||
*/
|
||||
|
||||
internal sealed class CBZip2OutputStream : Stream, IStreamStack
|
||||
internal sealed class CBZip2OutputStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => bsStream;
|
||||
|
||||
private const int SETMASK = (1 << 21);
|
||||
private const int CLEARMASK = (~SETMASK);
|
||||
private const int GREATER_ICOST = 15;
|
||||
|
||||
@@ -29,14 +29,11 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Deflate;
|
||||
|
||||
public partial class DeflateStream : Stream, IStreamStack
|
||||
public partial class DeflateStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _baseStream;
|
||||
|
||||
private readonly ZlibBaseStream _baseStream;
|
||||
private bool _disposed;
|
||||
private readonly bool _leaveOpen;
|
||||
|
||||
@@ -32,14 +32,11 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Deflate;
|
||||
|
||||
public partial class GZipStream : Stream, IStreamStack
|
||||
public partial class GZipStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => BaseStream;
|
||||
|
||||
internal static readonly DateTime UNIX_EPOCH = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
private string? _comment;
|
||||
|
||||
@@ -34,7 +34,6 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Common.Tar.Headers;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Deflate;
|
||||
|
||||
@@ -45,10 +44,8 @@ internal enum ZlibStreamFlavor
|
||||
GZIP = 1952,
|
||||
}
|
||||
|
||||
internal class ZlibBaseStream : Stream, IStreamStack
|
||||
internal class ZlibBaseStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
protected internal ZlibCodec _z; // deferred init... new ZlibCodec();
|
||||
|
||||
protected internal StreamMode _streamMode = StreamMode.Undefined;
|
||||
|
||||
@@ -30,14 +30,11 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Deflate;
|
||||
|
||||
public partial class ZlibStream : Stream, IStreamStack
|
||||
public partial class ZlibStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _baseStream;
|
||||
|
||||
private readonly ZlibBaseStream _baseStream;
|
||||
private bool _disposed;
|
||||
|
||||
|
||||
@@ -10,14 +10,11 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Zip;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Deflate64;
|
||||
|
||||
public sealed partial class Deflate64Stream : Stream, IStreamStack
|
||||
public sealed partial class Deflate64Stream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
private const int DEFAULT_BUFFER_SIZE = 8192;
|
||||
|
||||
private Stream _stream;
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.Common.Zip.Headers;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Explode;
|
||||
|
||||
public partial class ExplodeStream : Stream, IStreamStack
|
||||
public partial class ExplodeStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => inStream;
|
||||
|
||||
private const int INVALID_CODE = 99;
|
||||
private const int WSIZE = 64 * 1024;
|
||||
|
||||
|
||||
@@ -5,14 +5,11 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Compressors.LZMA.Utilites;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.LZMA;
|
||||
|
||||
internal sealed partial class AesDecoderStream : DecoderStream2, IStreamStack
|
||||
internal sealed partial class AesDecoderStream : DecoderStream2
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => mStream;
|
||||
|
||||
private readonly Stream mStream;
|
||||
private readonly ICryptoTransform mDecoder;
|
||||
private readonly byte[] mBuffer;
|
||||
|
||||
@@ -3,14 +3,11 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.LZMA;
|
||||
|
||||
internal class Bcj2DecoderStream : DecoderStream2, IStreamStack
|
||||
internal class Bcj2DecoderStream : DecoderStream2
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _mMainStream;
|
||||
|
||||
private const int K_NUM_TOP_BITS = 24;
|
||||
private const uint K_TOP_VALUE = (1 << K_NUM_TOP_BITS);
|
||||
|
||||
|
||||
@@ -17,10 +17,8 @@ namespace SharpCompress.Compressors.LZMA;
|
||||
/// <summary>
|
||||
/// Stream supporting the LZIP format, as documented at http://www.nongnu.org/lzip/manual/lzip_manual.html
|
||||
/// </summary>
|
||||
public sealed partial class LZipStream : Stream, IStreamStack
|
||||
public sealed partial class LZipStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
private readonly Stream _stream;
|
||||
private readonly CountingStream? _countingWritableSubStream;
|
||||
private bool _disposed;
|
||||
|
||||
@@ -4,14 +4,11 @@ using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Compressors.LZMA.LZ;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.LZMA;
|
||||
|
||||
public partial class LzmaStream : Stream, IStreamStack
|
||||
public partial class LzmaStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _inputStream!;
|
||||
|
||||
private readonly Stream? _inputStream;
|
||||
private readonly long _inputSize;
|
||||
private readonly long _outputSize;
|
||||
|
||||
@@ -2,11 +2,10 @@ using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.LZMA.Utilites;
|
||||
|
||||
internal partial class CrcBuilderStream : Stream, IStreamStack
|
||||
internal partial class CrcBuilderStream : Stream
|
||||
{
|
||||
public override async Task WriteAsync(
|
||||
byte[] buffer,
|
||||
|
||||
@@ -2,14 +2,11 @@ using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.LZMA.Utilites;
|
||||
|
||||
internal partial class CrcBuilderStream : Stream, IStreamStack
|
||||
internal partial class CrcBuilderStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _mTarget;
|
||||
|
||||
private readonly Stream _mTarget;
|
||||
private uint _mCrc;
|
||||
private bool _mFinished;
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Lzw
|
||||
{
|
||||
@@ -45,10 +44,8 @@ namespace SharpCompress.Compressors.Lzw
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
public partial class LzwStream : Stream, IStreamStack
|
||||
public partial class LzwStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => baseInputStream;
|
||||
|
||||
public static bool IsLzwStream(Stream stream)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -7,14 +7,11 @@ using System.Threading.Tasks;
|
||||
using SharpCompress.Compressors.LZMA.RangeCoder;
|
||||
using SharpCompress.Compressors.PPMd.H;
|
||||
using SharpCompress.Compressors.PPMd.I1;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.PPMd;
|
||||
|
||||
public class PpmdStream : Stream, IStreamStack
|
||||
public class PpmdStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
private readonly PpmdProperties _properties;
|
||||
private readonly Stream _stream;
|
||||
private readonly bool _compress;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.RLE90
|
||||
{
|
||||
@@ -8,10 +7,8 @@ namespace SharpCompress.Compressors.RLE90
|
||||
/// Real-time streaming RLE90 decompression stream.
|
||||
/// Decompresses bytes on demand without buffering the entire file in memory.
|
||||
/// </summary>
|
||||
public class RunLength90Stream : Stream, IStreamStack
|
||||
public class RunLength90Stream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
private readonly Stream _stream;
|
||||
private readonly int _compressedSize;
|
||||
private int _bytesReadFromSource;
|
||||
|
||||
@@ -5,13 +5,10 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Rar;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Rar;
|
||||
|
||||
internal sealed partial class MultiVolumeReadOnlyAsyncStream
|
||||
: MultiVolumeReadOnlyStreamBase,
|
||||
IStreamStack
|
||||
internal sealed partial class MultiVolumeReadOnlyAsyncStream : MultiVolumeReadOnlyStreamBase
|
||||
{
|
||||
internal static async ValueTask<MultiVolumeReadOnlyAsyncStream> Create(
|
||||
IAsyncEnumerable<RarFilePart> parts
|
||||
|
||||
@@ -4,16 +4,11 @@ using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Rar;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Rar;
|
||||
|
||||
internal sealed partial class MultiVolumeReadOnlyAsyncStream
|
||||
: MultiVolumeReadOnlyStreamBase,
|
||||
IStreamStack
|
||||
internal sealed partial class MultiVolumeReadOnlyAsyncStream : MultiVolumeReadOnlyStreamBase
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => currentStream.NotNull();
|
||||
|
||||
private long currentPosition;
|
||||
private long maxPosition;
|
||||
|
||||
|
||||
@@ -5,13 +5,10 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Rar;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Rar;
|
||||
|
||||
internal sealed partial class MultiVolumeReadOnlyStream
|
||||
: MultiVolumeReadOnlyStreamBase,
|
||||
IStreamStack
|
||||
internal sealed partial class MultiVolumeReadOnlyStream : MultiVolumeReadOnlyStreamBase
|
||||
{
|
||||
public override async Task<int> ReadAsync(
|
||||
byte[] buffer,
|
||||
|
||||
@@ -3,16 +3,11 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Rar;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Rar;
|
||||
|
||||
internal sealed partial class MultiVolumeReadOnlyStream
|
||||
: MultiVolumeReadOnlyStreamBase,
|
||||
IStreamStack
|
||||
internal sealed partial class MultiVolumeReadOnlyStream : MultiVolumeReadOnlyStreamBase
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => currentStream.NotNull();
|
||||
|
||||
private long currentPosition;
|
||||
private long maxPosition;
|
||||
|
||||
|
||||
@@ -4,11 +4,10 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Rar.Headers;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Rar;
|
||||
|
||||
internal partial class RarBLAKE2spStream : RarStream, IStreamStack
|
||||
internal partial class RarBLAKE2spStream : RarStream
|
||||
{
|
||||
public static async ValueTask<RarBLAKE2spStream> CreateAsync(
|
||||
IRarUnpack unpack,
|
||||
|
||||
@@ -5,14 +5,11 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Rar.Headers;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Rar;
|
||||
|
||||
internal partial class RarBLAKE2spStream : RarStream, IStreamStack
|
||||
internal partial class RarBLAKE2spStream : RarStream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => readStream;
|
||||
|
||||
private readonly MultiVolumeReadOnlyStreamBase readStream;
|
||||
private readonly bool disableCRCCheck;
|
||||
|
||||
|
||||
@@ -4,11 +4,10 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Rar.Headers;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Rar;
|
||||
|
||||
internal partial class RarCrcStream : RarStream, IStreamStack
|
||||
internal partial class RarCrcStream : RarStream
|
||||
{
|
||||
public static async ValueTask<RarCrcStream> CreateAsync(
|
||||
IRarUnpack unpack,
|
||||
|
||||
@@ -4,14 +4,11 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Rar.Headers;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Rar;
|
||||
|
||||
internal partial class RarCrcStream : RarStream, IStreamStack
|
||||
internal partial class RarCrcStream : RarStream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => readStream;
|
||||
|
||||
private readonly MultiVolumeReadOnlyStreamBase readStream;
|
||||
private uint currentCrc;
|
||||
private readonly bool disableCRC;
|
||||
|
||||
@@ -4,14 +4,11 @@ using System;
|
||||
using System.Buffers;
|
||||
using System.IO;
|
||||
using SharpCompress.Common.Rar.Headers;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Rar;
|
||||
|
||||
internal partial class RarStream : Stream, IStreamStack
|
||||
internal partial class RarStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => readStream;
|
||||
|
||||
private readonly IRarUnpack unpack;
|
||||
private readonly FileHeader fileHeader;
|
||||
private readonly Stream readStream;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Reduce;
|
||||
|
||||
public partial class ReduceStream : Stream, IStreamStack
|
||||
public partial class ReduceStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => inStream;
|
||||
|
||||
private readonly long unCompressedSize;
|
||||
private readonly long compressedSize;
|
||||
private readonly Stream inStream;
|
||||
|
||||
@@ -2,11 +2,10 @@ using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Shrink;
|
||||
|
||||
internal partial class ShrinkStream : Stream, IStreamStack
|
||||
internal partial class ShrinkStream : Stream
|
||||
{
|
||||
internal static async ValueTask<ShrinkStream> CreateAsync(
|
||||
Stream stream,
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Shrink;
|
||||
|
||||
internal partial class ShrinkStream : Stream, IStreamStack
|
||||
internal partial class ShrinkStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => inStream;
|
||||
|
||||
private Stream inStream;
|
||||
private CompressionMode _compressionMode;
|
||||
|
||||
|
||||
@@ -3,15 +3,12 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using SharpCompress.Compressors.RLE90;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Squeezed
|
||||
{
|
||||
[CLSCompliant(true)]
|
||||
public class SqueezeStream : Stream, IStreamStack
|
||||
public class SqueezeStream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
private readonly Stream _stream;
|
||||
private readonly int _compressedSize;
|
||||
private const int NUMVALS = 257;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Xz;
|
||||
|
||||
public abstract class XZReadOnlyStream : ReadOnlyStream, IStreamStack
|
||||
public abstract class XZReadOnlyStream : ReadOnlyStream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => base.BaseStream;
|
||||
|
||||
public XZReadOnlyStream(Stream stream)
|
||||
{
|
||||
BaseStream = stream;
|
||||
|
||||
@@ -5,15 +5,12 @@ using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.Xz;
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public sealed partial class XZStream : XZReadOnlyStream, IStreamStack
|
||||
public sealed partial class XZStream : XZReadOnlyStream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => _baseStream;
|
||||
|
||||
public XZStream(Stream baseStream)
|
||||
: base(baseStream)
|
||||
{
|
||||
|
||||
@@ -5,16 +5,13 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Compressors.ZStandard;
|
||||
|
||||
internal partial class ZStandardStream : DecompressionStream, IStreamStack
|
||||
internal partial class ZStandardStream : DecompressionStream
|
||||
{
|
||||
private readonly Stream stream;
|
||||
|
||||
Stream IStreamStack.BaseStream() => stream;
|
||||
|
||||
internal static bool IsZStandard(Stream stream)
|
||||
{
|
||||
var buffer = new byte[4];
|
||||
|
||||
@@ -2,15 +2,12 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Crypto;
|
||||
|
||||
[CLSCompliant(false)]
|
||||
public sealed class Crc32Stream : Stream, IStreamStack
|
||||
public sealed class Crc32Stream : Stream
|
||||
{
|
||||
Stream IStreamStack.BaseStream() => stream;
|
||||
|
||||
private readonly Stream stream;
|
||||
private readonly uint[] _table;
|
||||
private uint seed;
|
||||
|
||||
@@ -2,20 +2,13 @@ using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Test.Mocks;
|
||||
|
||||
public class AsyncOnlyStream : Stream, IStreamStack
|
||||
public class AsyncOnlyStream : Stream
|
||||
{
|
||||
private readonly Stream _stream;
|
||||
|
||||
#if DEBUG_STREAMS
|
||||
long IStreamStack.InstanceId { get; set; }
|
||||
#endif
|
||||
|
||||
Stream IStreamStack.BaseStream() => _stream;
|
||||
|
||||
public AsyncOnlyStream(Stream stream)
|
||||
{
|
||||
_stream = stream ?? throw new ArgumentNullException(nameof(stream));
|
||||
|
||||
@@ -83,6 +83,30 @@ public class ZipReaderAsyncTests : ReaderTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async ValueTask Zip_Deflate_Streamed2_Skip_Async()
|
||||
{
|
||||
using Stream stream = new ForwardOnlyStream(
|
||||
File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Zip.deflate.dd-.zip"))
|
||||
);
|
||||
await using var reader = await ReaderFactory.OpenAsyncReader(new AsyncOnlyStream(stream));
|
||||
var x = 0;
|
||||
while (await reader.MoveToNextEntryAsync())
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
{
|
||||
x++;
|
||||
if (x % 2 == 0)
|
||||
{
|
||||
await reader.WriteEntryToDirectoryAsync(
|
||||
SCRATCH_FILES_PATH,
|
||||
new ExtractionOptions { ExtractFullPath = true, Overwrite = true }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async ValueTask Zip_Deflate_Read_Async() =>
|
||||
await ReadAsync("Zip.deflate.zip", CompressionType.Deflate);
|
||||
|
||||
@@ -80,6 +80,30 @@ public class ZipReaderTests : ReaderTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Zip_Deflate_Streamed2_Skip()
|
||||
{
|
||||
using Stream stream = new ForwardOnlyStream(
|
||||
File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Zip.deflate.dd-.zip"))
|
||||
);
|
||||
using var reader = ReaderFactory.OpenReader(stream);
|
||||
var x = 0;
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
{
|
||||
x++;
|
||||
if (x % 2 == 0)
|
||||
{
|
||||
reader.WriteEntryToDirectory(
|
||||
SCRATCH_FILES_PATH,
|
||||
new ExtractionOptions { ExtractFullPath = true, Overwrite = true }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Zip_Deflate_Read() => Read("Zip.deflate.zip", CompressionType.Deflate);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user