Add constructor to ForcedSeekStream for initializing with a pre-created stream

This commit is contained in:
2026-04-19 13:34:50 +01:00
parent 7e73713df8
commit 86b5245261

View File

@@ -59,6 +59,19 @@ public sealed class ForcedSeekStream<T> : Stream where T : Stream
CalculateLength(); CalculateLength();
} }
/// <summary>Initializes a new instance of the <see cref="T:Aaru.Helpers.IO.ForcedSeekStream`1" /> class.</summary>
/// <param name="stream">A pre-created stream instance.</param>
/// <inheritdoc />
public ForcedSeekStream(long length, T stream)
{
_streamLength = length;
_baseStream = stream;
_backFile = Path.GetTempFileName();
_backStream = new FileStream(_backFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
if(length == 0) CalculateLength();
}
/// <summary>Initializes a new instance of the <see cref="T:Aaru.Helpers.IO.ForcedSeekStream`1" /> class.</summary> /// <summary>Initializes a new instance of the <see cref="T:Aaru.Helpers.IO.ForcedSeekStream`1" /> class.</summary>
/// <param name="length">The real (uncompressed) length of the stream.</param> /// <param name="length">The real (uncompressed) length of the stream.</param>
/// <param name="args">Parameters that are used to create the base stream.</param> /// <param name="args">Parameters that are used to create the base stream.</param>