mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-07-09 02:26:47 +00:00
updates from review
This commit is contained in:
@@ -18,7 +18,19 @@ public static class IArchiveEntryExtensions
|
||||
/// <param name="streamToWriteTo">The stream to write the entry content to.</param>
|
||||
/// <param name="progress">Optional progress reporter for tracking extraction progress.</param>
|
||||
public void WriteTo(Stream streamToWriteTo, IProgress<ProgressReport>? progress = null) =>
|
||||
archiveEntry.WriteTo(streamToWriteTo, null, progress: progress);
|
||||
archiveEntry.WriteTo(streamToWriteTo, bufferSize: null, progress: progress);
|
||||
|
||||
/// <summary>
|
||||
/// Extract entry to the specified stream.
|
||||
/// </summary>
|
||||
/// <param name="streamToWriteTo">The stream to write the entry content to.</param>
|
||||
/// <param name="options">Options for configuring extraction behavior.</param>
|
||||
/// <param name="progress">Optional progress reporter for tracking extraction progress.</param>
|
||||
public void WriteTo(
|
||||
Stream streamToWriteTo,
|
||||
ExtractionOptions options,
|
||||
IProgress<ProgressReport>? progress = null
|
||||
) => archiveEntry.WriteTo(streamToWriteTo, options.BufferSize, options, progress);
|
||||
|
||||
private void WriteTo(
|
||||
Stream streamToWriteTo,
|
||||
@@ -50,8 +62,7 @@ public static class IArchiveEntryExtensions
|
||||
Stream streamToWriteTo,
|
||||
IProgress<ProgressReport>? progress = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
) =>
|
||||
await archiveEntry
|
||||
.WriteToAsync(
|
||||
streamToWriteTo,
|
||||
@@ -60,7 +71,29 @@ public static class IArchiveEntryExtensions
|
||||
cancellationToken: cancellationToken
|
||||
)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract entry to the specified stream asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="streamToWriteTo">The stream to write the entry content to.</param>
|
||||
/// <param name="options">Options for configuring extraction behavior.</param>
|
||||
/// <param name="progress">Optional progress reporter for tracking extraction progress.</param>
|
||||
/// <param name="cancellationToken">Cancellation token.</param>
|
||||
public async ValueTask WriteToAsync(
|
||||
Stream streamToWriteTo,
|
||||
ExtractionOptions options,
|
||||
IProgress<ProgressReport>? progress = null,
|
||||
CancellationToken cancellationToken = default
|
||||
) =>
|
||||
await archiveEntry
|
||||
.WriteToAsync(
|
||||
streamToWriteTo,
|
||||
options.BufferSize,
|
||||
options,
|
||||
progress,
|
||||
cancellationToken
|
||||
)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
private async ValueTask WriteToAsync(
|
||||
Stream streamToWriteTo,
|
||||
|
||||
@@ -56,20 +56,7 @@ internal sealed class ChecksumValidationStream : Stream
|
||||
}
|
||||
#endif
|
||||
|
||||
public override int ReadByte()
|
||||
{
|
||||
var value = _stream.ReadByte();
|
||||
if (value == -1)
|
||||
{
|
||||
Validate();
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateChecksum([(byte)value]);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
public override int ReadByte() => throw new NotSupportedException();
|
||||
|
||||
public override async Task<int> ReadAsync(
|
||||
byte[] buffer,
|
||||
|
||||
Reference in New Issue
Block a user