This commit is contained in:
Adam Hathcock
2026-01-31 15:53:52 +00:00
parent 86e412cf77
commit 227e70926b
11 changed files with 11 additions and 13 deletions

View File

@@ -10,7 +10,6 @@ namespace SharpCompress.Common;
public partial class EntryStream : Stream, IStreamStack
{
Stream IStreamStack.BaseStream() => _stream;
private readonly IReader _reader;

View File

@@ -116,7 +116,9 @@ public abstract class RarVolume : Volume
if (fh.FileName == "CMT")
{
var buffer = new byte[fh.CompressedSize];
await fh.PackedStream.NotNull().ReadFullyAsync(buffer, cancellationToken);
await fh
.PackedStream.NotNull()
.ReadFullyAsync(buffer, cancellationToken);
Comment = Encoding.UTF8.GetString(buffer, 0, buffer.Length - 1);
}
}

View File

@@ -8,10 +8,8 @@ using SharpCompress.IO;
public partial class ArcLzwStream : Stream, IStreamStack
{
Stream IStreamStack.BaseStream() => _stream;
private Stream _stream;
private bool _processed;
private bool _useCrunched;

View File

@@ -8,7 +8,6 @@ namespace SharpCompress.Compressors.LZMA.Utilites;
internal partial class CrcBuilderStream : Stream, IStreamStack
{
Stream IStreamStack.BaseStream() => _mTarget;
private readonly Stream _mTarget;

View File

@@ -13,7 +13,6 @@ namespace SharpCompress.Compressors.PPMd;
public class PpmdStream : Stream, IStreamStack
{
Stream IStreamStack.BaseStream() => _stream;
private readonly PpmdProperties _properties;

View File

@@ -7,7 +7,6 @@ namespace SharpCompress.Compressors.Shrink;
internal partial class ShrinkStream : Stream, IStreamStack
{
Stream IStreamStack.BaseStream() => inStream;
private Stream inStream;

View File

@@ -41,8 +41,7 @@ internal class CountingStream : Stream
public override int Read(byte[] buffer, int offset, int count) =>
_stream.Read(buffer, offset, count);
public override long Seek(long offset, SeekOrigin origin) =>
_stream.Seek(offset, origin);
public override long Seek(long offset, SeekOrigin origin) => _stream.Seek(offset, origin);
public override void SetLength(long value) => _stream.SetLength(value);

View File

@@ -10,11 +10,9 @@ namespace SharpCompress.IO
{
public interface IStreamStack
{
/// <summary>
/// Returns the immediate underlying stream in the stack.
/// </summary>
Stream BaseStream();
}
}

View File

@@ -216,9 +216,11 @@ internal class NonDisposingStream : Stream, IStreamStack
}
public int DefaultBufferSize { get; set; }
public Stream BaseStream() => _stream;
public int BufferSize { get; set; }
public int BufferPosition { get; set; }
public void SetPosition(long position) => throw new NotImplementedException();
}

View File

@@ -23,7 +23,7 @@ internal partial class ReadOnlySubStream : Stream, IStreamStack
{
_stream = stream ?? throw new ArgumentNullException(nameof(stream));
_leaveOpen = leaveOpen;
if (origin != null && stream.Position != origin.Value)
{
stream.Position = origin.Value;

View File

@@ -43,7 +43,10 @@ public class WriterTests : TestBase
readerOptions.ArchiveEncoding.Default = encoding ?? Encoding.Default;
using var reader = ReaderFactory.OpenReader(new NonDisposingStream(stream), readerOptions);
using var reader = ReaderFactory.OpenReader(
new NonDisposingStream(stream),
readerOptions
);
reader.WriteAllToDirectory(
SCRATCH_FILES_PATH,
new ExtractionOptions { ExtractFullPath = true }