-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport System.IO.Compression docs #48841
Conversation
… cannot be referenced. Add O: prefix to method overloads.
…hyperlinks in xml, overload crefs,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending reviewing more files.
|
||
// This is an abstract concept and NOT the ZLib compression level. | ||
// There may or may not be any correspondence with the a possible implementation-specific level-parameter of the deflater. | ||
/// <summary>Specifies values that indicate whether a compression operation emphasizes speed or compression size.</summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These double slash comments should probably stay:
/// <summary>Specifies values that indicate whether a compression operation emphasizes speed or compression size.</summary> | |
// This is an abstract concept and NOT the ZLib compression level. | |
// There may or may not be any correspondence with the a possible implementation-specific level-parameter of the deflater. | |
/// <summary>Specifies values that indicate whether a compression operation emphasizes speed or compression size.</summary> |
/// [!code-vb[System.IO.Compression.DeflateStream#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.io.compression.deflatestream/vb/program1.vb#1)] | ||
/// ]]></format></example> | ||
/// <exception cref="System.ArgumentNullException"><paramref name="stream" /> is <see langword="null" />.</exception> | ||
/// <exception cref="System.ArgumentException">The stream does not support write operations such as compression. (The <see cref="System.IO.Stream.CanWrite" /> property on the stream object is <see langword="false" />.)</exception> | ||
public DeflateStream(Stream stream, CompressionLevel compressionLevel) : this(stream, compressionLevel, leaveOpen: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double slash comments should probably stay, but I'll move them here:
public DeflateStream(Stream stream, CompressionLevel compressionLevel) : this(stream, compressionLevel, leaveOpen: false) | |
// Implies mode = Compress | |
public DeflateStream(Stream stream, CompressionLevel compressionLevel) : this(stream, compressionLevel, leaveOpen: false) |
/// [!INCLUDE[remarks](~/includes/remarks/System.IO.Compression/DeflateStream/.ctor_Stream_CompressionLevel_Boolean.md)] | ||
/// ]]></format></remarks> | ||
/// <exception cref="System.ArgumentNullException"><paramref name="stream" /> is <see langword="null" />.</exception> | ||
/// <exception cref="System.ArgumentException">The stream does not support write operations such as compression. (The <see cref="System.IO.Stream.CanWrite" /> property on the stream object is <see langword="false" />.)</exception> | ||
public DeflateStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen) : this(stream, compressionLevel, leaveOpen, ZLibNative.Deflate_DefaultWindowBits) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public DeflateStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen) : this(stream, compressionLevel, leaveOpen, ZLibNative.Deflate_DefaultWindowBits) | |
// Implies mode = Compress | |
public DeflateStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen) : this(stream, compressionLevel, leaveOpen, ZLibNative.Deflate_DefaultWindowBits) |
/// <param name="buffer">A region of memory. When this method returns, the contents of this region are replaced by the bytes read from the current source.</param> | ||
/// <returns>The total number of bytes read into the buffer. This can be less than the number of bytes allocated in the buffer if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.</returns> | ||
/// <remarks>Use the <see cref="System.IO.Compression.DeflateStream.CanRead" /> property to determine whether the current instance supports reading. Use the <see cref="O:System.IO.Compression.DeflateStream.ReadAsync" /> method to read asynchronously from the current stream. | ||
/// This method read a maximum of `buffer.Length` bytes from the current stream and store them in <paramref name="buffer" />. The current position within the Deflate stream is advanced by the number of bytes read; however, if an exception occurs, the current position within the Deflate stream remains unchanged. This method will block until at least one byte of data can be read, in the event that no data is available. `Read` returns 0 only when there is no more data in the stream and no more is expected (such as a closed socket or end of file). The method is free to return fewer bytes than requested even if the end of the stream has not been reached. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to double check the cref on VS for the Span argument:
/// This method read a maximum of `buffer.Length` bytes from the current stream and store them in <paramref name="buffer" />. The current position within the Deflate stream is advanced by the number of bytes read; however, if an exception occurs, the current position within the Deflate stream remains unchanged. This method will block until at least one byte of data can be read, in the event that no data is available. `Read` returns 0 only when there is no more data in the stream and no more is expected (such as a closed socket or end of file). The method is free to return fewer bytes than requested even if the end of the stream has not been reached. | |
/// This method read a maximum of <c>buffer.Length</c> bytes from the current stream and store them in <paramref name="buffer" />. The current position within the Deflate stream is advanced by the number of bytes read; however, if an exception occurs, the current position within the Deflate stream remains unchanged. This method will block until at least one byte of data can be read, in the event that no data is available. <see cref="System.IO.Compression.DeflateStream.Read(System.Span<System.Byte>)" /> returns 0 only when there is no more data in the stream and no more is expected (such as a closed socket or end of file). The method is free to return fewer bytes than requested even if the end of the stream has not been reached. |
/// <param name="count">The maximum number of bytes to read.</param> | ||
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="System.Threading.CancellationToken.None" />.</param> | ||
/// <returns>A task that represents the asynchronous read operation, which wraps the total number of bytes read into the <paramref name="buffer" />. The result value can be less than the number of bytes requested if the number of bytes currently available is less than the requested number, or it can be 0 (zero) if the end of the Deflate stream has been reached.</returns> | ||
/// <remarks>The `ReadAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to double check the cref signature in VS:
/// <remarks>The `ReadAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. | |
/// <remarks>The <see cref="System.IO.Compression.DeflateStream.ReadAsync(System.Byte[],System.Int32,System.Int32,System.Threading.CancellationToken)" /> method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The asynchronous methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
/// <param name="buffer">The region of memory to write the data into.</param> | ||
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="System.Threading.CancellationToken.None" />.</param> | ||
/// <returns>A task that represents the asynchronous read operation, which wraps the total number of bytes read into the buffer. The result value can be less than the number of bytes allocated in the buffer if that many bytes are not currently available, or it can be 0 (zero) if the end of the Deflate stream has been reached.</returns> | ||
/// <remarks>The `ReadAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to double check the signature:
/// <remarks>The `ReadAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. | |
/// <remarks>The <see cref="System.IO.Compression.DeflateStream.ReadAsync(System.Memory<System.Byte>,System.Threading.CancellationToken)" /> method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The asynchronous methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
/// <remarks>The `DisposeAsync` method enables you to perform a resource-intensive dispose operation without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. | ||
/// This method disposes the Deflate stream by writing any changes to the backing store and closing the stream to release resources. | ||
/// Calling `DisposeAsync` allows the resources used by the <see cref="System.IO.Compression.DeflateStream" /> to be reallocated for other purposes. For more information, see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged).</remarks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <remarks>The `DisposeAsync` method enables you to perform a resource-intensive dispose operation without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. | |
/// This method disposes the Deflate stream by writing any changes to the backing store and closing the stream to release resources. | |
/// Calling `DisposeAsync` allows the resources used by the <see cref="System.IO.Compression.DeflateStream" /> to be reallocated for other purposes. For more information, see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged).</remarks> | |
/// <remarks>The <see cref="System.IO.Compression.DeflateStream.DisposeAsync()" /> method enables you to perform a resource-intensive dispose operation without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. | |
/// This method disposes the Deflate stream by writing any changes to the backing store and closing the stream to release resources. | |
/// Calling <see cref="System.IO.Compression.DeflateStream.DisposeAsync()" /> allows the resources used by the <see cref="System.IO.Compression.DeflateStream" /> to be reallocated for other purposes. For more information, see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged).</remarks> |
/// <param name="count">The maximum number of bytes to write.</param> | ||
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="System.Threading.CancellationToken.None" />.</param> | ||
/// <returns>A task that represents the asynchronous write operation.</returns> | ||
/// <remarks>The `WriteAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <remarks>The `WriteAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. | |
/// <remarks>The <see cref="System.IO.Compression.DeflateStream.WriteAsync(System.Byte[],System.Int32,System.Int32,System.Threading.CancellationToken)" /> method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The asynchronous methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
/// <param name="buffer">The region of memory to write data from.</param> | ||
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="System.Threading.CancellationToken.None" />.</param> | ||
/// <returns>A task that represents the asynchronous write operation.</returns> | ||
/// <remarks>The `WriteAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <remarks>The `WriteAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. | |
/// <remarks>The <see cref="System.IO.Compression.DeflateStream.WriteAsync(System.ReadOnlyMemory<System.Byte>,System.Threading.CancellationToken)" /> method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The asynchronous methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
/// <param name="bufferSize">The size, in bytes, of the buffer. This value must be greater than zero. The default size is 81920.</param> | ||
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="System.Threading.CancellationToken.None" />.</param> | ||
/// <returns>A task that represents the asynchronous copy operation.</returns> | ||
/// <remarks>The `CopyToAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <remarks>The `CopyToAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. | |
/// <remarks>The <see cref="System.IO.Compression.DeflateStream.CopyToAsync(System.IO.Stream,System.Int32,System.Threading.CancellationToken)" /> method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The asynchronous methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
// There may or may not be any correspondence with the a possible implementation-specific level-parameter of the deflater. | ||
/// <summary>Specifies values that indicate whether a compression operation emphasizes speed or compression size.</summary> | ||
/// <remarks><format type="text/markdown"><] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link can't be followed from runtime's source... is there a value on porting it? Perhaps you could ignore it and keep the source of truth in dotnet-api-docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding from the docs is that we do want to port these links over.
/// <summary> | ||
/// The compression operation should balance compression speed and output size. | ||
/// </summary> | ||
/// <summary>The compression operation should be optimally compressed, even if the operation takes a longer time to complete.</summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old and new sentences are describing completely different behaviors, do you know if the new one is actually true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it seems it should be written as:
/// <summary>The compression operation should be optimally compressed, balancing compression speed and output size.</summary>
/// <remarks>This enumeration is used with the <see cref="System.IO.Compression.GZipStream" /> and <see cref="System.IO.Compression.DeflateStream" /> classes.</remarks> | ||
/// <example>The following code example uses the <see cref="System.IO.Compression.CompressionMode" /> enumeration with the <see cref="System.IO.Compression.GZipStream" /> class to compress and decompress a file. | ||
/// <format type="text/markdown"><] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as #48841 (comment).
/// The underlying stream does not support reading.</exception> | ||
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="offset" /> or <paramref name="count" /> is less than zero. | ||
/// -or- | ||
/// <paramref name="buffer" /> length minus the index starting point is less than <paramref name="count" />.</exception> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument buffer
is called array
in the docs... should docs be changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it was renamed in October with 0acbafe#diff-a076647d6d5119e4e3b482835f098318b585fc7fd9cb16116c45395721c61c3d.
What release is that in? And do we need to document it as a breaking change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public GZipStream(Stream stream, CompressionMode mode, bool leaveOpen) | ||
{ | ||
_deflateStream = new DeflateStream(stream, mode, leaveOpen, ZLibNative.GZip_DefaultWindowBits); | ||
} | ||
|
||
// Implies mode = Compress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another double-slash comment lost.
public GZipStream(Stream stream, CompressionLevel compressionLevel) : this(stream, compressionLevel, leaveOpen: false) | ||
{ | ||
} | ||
|
||
// Implies mode = Compress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
/// <summary>Waits for the pending asynchronous read to complete. (Consider using the <see cref="System.IO.Stream.ReadAsync(byte[],int,int)" /> method instead.)</summary> | ||
/// <param name="asyncResult">The reference to the pending asynchronous request to finish.</param> | ||
/// <returns>The number of bytes read from the stream, between 0 (zero) and the number of bytes you requested. <see cref="System.IO.Compression.GZipStream" /> returns 0 only at the end of the stream; otherwise, it blocks until at least one byte is available.</returns> | ||
/// <remarks>Starting with the .NET Framework 4.5, you can perform asynchronous read operations by using the <see cref="O:System.IO.Stream.ReadAsync" /> method. The <see cref="System.IO.Compression.GZipStream.EndRead" /> method is still available in .NET Framework 4.5 to support legacy code; however, you can implement asynchronous I/O operations more easily by using the new async methods. For more information, see <a href="https://docs.microsoft.com/en-us/dotnet/standard/io/asynchronous-file-i-o">Asynchronous File I/O</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the O:
in <see cref="O:System.IO.Stream.ReadAsync" />
mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is for referencing an overloaded method. Notes here.
public override void CopyTo(Stream destination, int bufferSize) | ||
{ | ||
CheckDeflateStream(); | ||
_deflateStream.CopyTo(destination, bufferSize); | ||
} | ||
|
||
/// <summary>Releases the unmanaged resources used by the <see cref="System.IO.Compression.GZipStream" /> and optionally releases the managed resources.</summary> | ||
/// <param name="disposing"><see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.</param> | ||
/// <remarks>This method is called by the public <see langword="System.ComponentModel.Component.Dispose" /> method and the <see cref="object.Finalize" /> method. <see langword="System.ComponentModel.Component.Dispose" /> invokes the protected <see cref="System.IO.Compression.GZipStream.Dispose" /> method with the <paramref name="disposing" /> parameter set to <see langword="true" />. <see cref="object.Finalize" /> invokes <see cref="System.IO.Compression.GZipStream.Dispose" /> with <paramref name="disposing" /> set to <see langword="false" />. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be <see cref="...Dispose" />
instead of <see langword="...Dispose" />
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're correct; good catch @jozkee!
/// <remarks>This method is called by the public <see langword="System.ComponentModel.Component.Dispose" /> method and the <see cref="object.Finalize" /> method. <see langword="System.ComponentModel.Component.Dispose" /> invokes the protected <see cref="System.IO.Compression.GZipStream.Dispose" /> method with the <paramref name="disposing" /> parameter set to <see langword="true" />. <see cref="object.Finalize" /> invokes <see cref="System.IO.Compression.GZipStream.Dispose" /> with <paramref name="disposing" /> set to <see langword="false" />. | |
/// <remarks>This method is called by the public <see cref="System.ComponentModel.Component.Dispose" /> method and the <see cref="object.Finalize" /> method. <see cref="System.ComponentModel.Component.Dispose" /> invokes the protected <see cref="System.IO.Compression.GZipStream.Dispose" /> method with the <paramref name="disposing" /> parameter set to <see langword="true" />. <see cref="object.Finalize" /> invokes <see cref="System.IO.Compression.GZipStream.Dispose" /> with <paramref name="disposing" /> set to <see langword="false" />. |
/// <param name="buffer">The region of memory to write the data into.</param> | ||
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="System.Threading.CancellationToken.None" />.</param> | ||
/// <returns>A task that represents the asynchronous read operation, which wraps the total number of bytes read into the buffer. The result value can be less than the number of bytes allocated in the buffer if that many bytes are not currently available, or it can be 0 (zero) if the end of the GZip stream has been reached.</returns> | ||
/// <remarks>The `ReadAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <remarks>The `ReadAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. | |
/// <remarks>The <see cref="System.IO.Compression.GZipStream.ReadAsync" /> method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
/// <param name="count">The maximum number of bytes to write.</param> | ||
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="System.Threading.CancellationToken.None" />.</param> | ||
/// <returns>A task that represents the asynchronous write operation.</returns> | ||
/// <remarks>The `WriteAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <remarks>The `WriteAsync` method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. | |
/// <remarks>The <see cref="System.IO.Compression.GZipStream.WriteAsync" /> method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the <see langword="async" /> and <see langword="await" /> keywords in Visual Basic and C#. |
#if DEBUG_FORCE_ZIP64 | ||
public bool _forceZip64; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look like something that should be removed in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I've been working on dotnet/api-docs-sync#65, but we'll have to manually fix it here.
/// <param name="stream">The input or output stream.</param> | ||
/// <param name="mode">See the description of the ZipArchiveMode enum. Read requires the stream to support reading, Create requires the stream to support writing, and Update requires the stream to support reading, writing, and seeking.</param> | ||
/// <param name="leaveOpen">true to leave the stream open upon disposing the ZipArchive, otherwise false.</param> | ||
/// <param name="entryNameEncoding">The encoding to use when reading or writing entry names in this ZipArchive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the info in this param still relevant? Seems that it is not captured in the documentation page for this ctor
@@ -211,12 +184,17 @@ public ZipArchive(Stream stream, ZipArchiveMode mode, bool leaveOpen, Encoding? | |||
} | |||
} | |||
|
|||
/// <summary> | |||
/// The collection of entries that are currently in the ZipArchive. This may not accurately represent the actual entries that are present in the underlying file or stream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may not accurately represent the actual entries that are present in the underlying file or stream.
This is not captured anywhere in the documentation page https://docs.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchive.entries?view=net-5.0
@@ -278,13 +297,23 @@ public void Delete() | |||
UnloadStreams(); | |||
} | |||
|
|||
/// <summary> | |||
/// Opens the entry. If the archive that the entry belongs to was opened in Read mode, the returned stream will be readable, and it may or may not be seekable. If Create mode, the returned stream will be writable and not seekable. If Update mode, the returned stream will be readable, writable, seekable, and support SetLength. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the archive that the entry belongs to was opened in Read mode, the returned stream will be readable, and it may or may not be seekable. If Create mode, the returned stream will be writable and not seekable. If Update mode, the returned stream will be readable, writable, seekable, and support SetLength.
Consider adding this to https://docs.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.open?view=net-5.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise; LGTM.
@@ -3,9 +3,18 @@ | |||
|
|||
namespace System.IO.Compression | |||
{ | |||
/// <summary>Specifies whether to compress or decompress the underlying stream.</summary> | |||
/// <remarks>This enumeration is used with the <see cref="System.IO.Compression.GZipStream" /> and <see cref="System.IO.Compression.DeflateStream" /> classes.</remarks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should fix the formatting of these tags before running the automation on everything.
/// <remarks>This enumeration is used with the <see cref="System.IO.Compression.GZipStream" /> and <see cref="System.IO.Compression.DeflateStream" /> classes.</remarks> | |
/// <remarks>This enumeration is used with the <see cref="System.IO.Compression.GZipStream"/> and <see cref="System.IO.Compression.DeflateStream"/> classes.</remarks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've always had the space character in there in dotnet-api-docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VS does not insert the trailing space before the slash. I've wondered if it would be better to be consistent with what VS is going to do. I've opened dotnet/api-docs-sync#73 for that, but we don't need to block this PR on that issue; we can run a revision run to reformat.
/// <exception cref="System.IO.IOException">The entry is already currently open for writing. | ||
/// -or- | ||
/// The entry has been deleted from the archive. | ||
/// -or- | ||
/// The archive for this entry was opened with the <see cref="System.IO.Compression.ZipArchiveMode.Create" /> mode, and this entry has already been written to.</exception> | ||
/// <exception cref="System.IO.InvalidDataException">The entry is either missing from the archive or is corrupt and cannot be read. | ||
/// -or- | ||
/// The entry has been compressed by using a compression method that is not supported.</exception> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the required <para>
elements are missing
/// <exception cref="System.IO.IOException">The entry is already currently open for writing. | |
/// -or- | |
/// The entry has been deleted from the archive. | |
/// -or- | |
/// The archive for this entry was opened with the <see cref="System.IO.Compression.ZipArchiveMode.Create" /> mode, and this entry has already been written to.</exception> | |
/// <exception cref="System.IO.InvalidDataException">The entry is either missing from the archive or is corrupt and cannot be read. | |
/// -or- | |
/// The entry has been compressed by using a compression method that is not supported.</exception> | |
/// <exception cref="System.IO.IOException"><para>The entry is already currently open for writing.</para> | |
/// <para>-or-</para> | |
/// <para>The entry has been deleted from the archive.</para> | |
/// <para>-or-</para> | |
/// <para>The archive for this entry was opened with the <see cref="System.IO.Compression.ZipArchiveMode.Create" /> mode, and this entry has already been written to.</para></exception> | |
/// <exception cref="System.IO.InvalidDataException"><para>The entry is either missing from the archive or is corrupt and cannot be read.</para> | |
/// <para>-or-</para> | |
/// <para>The entry has been compressed by using a compression method that is not supported.</para></exception> |
public override long Position | ||
{ | ||
get { throw new NotSupportedException(SR.NotSupported); } | ||
set { throw new NotSupportedException(SR.NotSupported); } | ||
} | ||
|
||
/// <summary>The current implementation of this method has no functionality.</summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The summary doesn't seem correct.
// There may or may not be any correspondence with the a possible implementation-specific level-parameter of the deflater. | ||
/// <summary>Specifies values that indicate whether a compression operation emphasizes speed or compression size.</summary> | ||
/// <remarks><format type="text/markdown"><] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding from the docs is that we do want to port these links over.
/// <summary> | ||
/// The compression operation should balance compression speed and output size. | ||
/// </summary> | ||
/// <summary>The compression operation should be optimally compressed, even if the operation takes a longer time to complete.</summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it seems it should be written as:
/// <summary>The compression operation should be optimally compressed, balancing compression speed and output size.</summary>
@@ -3,9 +3,18 @@ | |||
|
|||
namespace System.IO.Compression | |||
{ | |||
/// <summary>Specifies whether to compress or decompress the underlying stream.</summary> | |||
/// <remarks>This enumeration is used with the <see cref="System.IO.Compression.GZipStream" /> and <see cref="System.IO.Compression.DeflateStream" /> classes.</remarks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VS does not insert the trailing space before the slash. I've wondered if it would be better to be consistent with what VS is going to do. I've opened dotnet/api-docs-sync#73 for that, but we don't need to block this PR on that issue; we can run a revision run to reformat.
/// [!code-vb[System.IO.Compression.GZipStream#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.io.compression.gzipstream/vb/program1.vb#1)] | ||
/// ]]></format></example> | ||
/// <exception cref="System.ArgumentNullException"><paramref name="stream" /> is <see langword="null" />.</exception> | ||
/// <exception cref="System.ArgumentException">The stream does not support write operations such as compression. (The <see cref="System.IO.Stream.CanWrite" /> property on the stream object is <see langword="false" />.)</exception> | ||
public GZipStream(Stream stream, CompressionLevel compressionLevel) : this(stream, compressionLevel, leaveOpen: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public GZipStream(Stream stream, CompressionLevel compressionLevel) : this(stream, compressionLevel, leaveOpen: false) | |
// Implies mode = Compress | |
public GZipStream(Stream stream, CompressionLevel compressionLevel) : this(stream, compressionLevel, leaveOpen: false) |
/// [!code-vb[System.IO.Compression.GZipStream#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.io.compression.gzipstream/vb/program2.vb#2)] | ||
/// ]]></format></example> | ||
/// <exception cref="System.ArgumentNullException"><paramref name="stream" /> is <see langword="null" />.</exception> | ||
/// <exception cref="System.ArgumentException">The stream does not support write operations such as compression. (The <see cref="System.IO.Stream.CanWrite" /> property on the stream object is <see langword="false" />.)</exception> | ||
public GZipStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public GZipStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen) | |
// Implies mode = Compress | |
public GZipStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen) |
/// <summary>Waits for the pending asynchronous read to complete. (Consider using the <see cref="System.IO.Stream.ReadAsync(byte[],int,int)" /> method instead.)</summary> | ||
/// <param name="asyncResult">The reference to the pending asynchronous request to finish.</param> | ||
/// <returns>The number of bytes read from the stream, between 0 (zero) and the number of bytes you requested. <see cref="System.IO.Compression.GZipStream" /> returns 0 only at the end of the stream; otherwise, it blocks until at least one byte is available.</returns> | ||
/// <remarks>Starting with the .NET Framework 4.5, you can perform asynchronous read operations by using the <see cref="O:System.IO.Stream.ReadAsync" /> method. The <see cref="System.IO.Compression.GZipStream.EndRead" /> method is still available in .NET Framework 4.5 to support legacy code; however, you can implement asynchronous I/O operations more easily by using the new async methods. For more information, see <a href="https://docs.microsoft.com/en-us/dotnet/standard/io/asynchronous-file-i-o">Asynchronous File I/O</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is for referencing an overloaded method. Notes here.
public override void CopyTo(Stream destination, int bufferSize) | ||
{ | ||
CheckDeflateStream(); | ||
_deflateStream.CopyTo(destination, bufferSize); | ||
} | ||
|
||
/// <summary>Releases the unmanaged resources used by the <see cref="System.IO.Compression.GZipStream" /> and optionally releases the managed resources.</summary> | ||
/// <param name="disposing"><see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.</param> | ||
/// <remarks>This method is called by the public <see langword="System.ComponentModel.Component.Dispose" /> method and the <see cref="object.Finalize" /> method. <see langword="System.ComponentModel.Component.Dispose" /> invokes the protected <see cref="System.IO.Compression.GZipStream.Dispose" /> method with the <paramref name="disposing" /> parameter set to <see langword="true" />. <see cref="object.Finalize" /> invokes <see cref="System.IO.Compression.GZipStream.Dispose" /> with <paramref name="disposing" /> set to <see langword="false" />. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're correct; good catch @jozkee!
/// <remarks>This method is called by the public <see langword="System.ComponentModel.Component.Dispose" /> method and the <see cref="object.Finalize" /> method. <see langword="System.ComponentModel.Component.Dispose" /> invokes the protected <see cref="System.IO.Compression.GZipStream.Dispose" /> method with the <paramref name="disposing" /> parameter set to <see langword="true" />. <see cref="object.Finalize" /> invokes <see cref="System.IO.Compression.GZipStream.Dispose" /> with <paramref name="disposing" /> set to <see langword="false" />. | |
/// <remarks>This method is called by the public <see cref="System.ComponentModel.Component.Dispose" /> method and the <see cref="object.Finalize" /> method. <see cref="System.ComponentModel.Component.Dispose" /> invokes the protected <see cref="System.IO.Compression.GZipStream.Dispose" /> method with the <paramref name="disposing" /> parameter set to <see langword="true" />. <see cref="object.Finalize" /> invokes <see cref="System.IO.Compression.GZipStream.Dispose" /> with <paramref name="disposing" /> set to <see langword="false" />. |
#if DEBUG_FORCE_ZIP64 | ||
public bool _forceZip64; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I've been working on dotnet/api-docs-sync#65, but we'll have to manually fix it here.
/// <exception cref="ArgumentNullException">The stream is null.</exception> | ||
/// <exception cref="InvalidDataException">The contents of the stream could not be interpreted as a Zip archive.</exception> | ||
/// <param name="stream">The stream containing the archive to be read.</param> | ||
/// <summary>Initializes a new instance of the <see cref="System.IO.Compression.ZipArchive" /> class from the specified stream.</summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <summary>Initializes a new instance of the <see cref="System.IO.Compression.ZipArchive" /> class from the specified stream.</summary> | |
#if DEBUG_FORCE_ZIP64 | |
public bool _forceZip64; | |
#endif | |
/// <summary>Initializes a new instance of the <see cref="System.IO.Compression.ZipArchive" /> class from the specified stream.</summary> |
Draft Pull Request was automatically closed for inactivity. Please let us know if you'd like to reopen it. |
Includes types from System.IO.Compression, except those found in Compression.ZipFile (PR in review) and Compression.Brotli (merged PR).
Backport automated using DocsPortingTool with this command:
Related PRs:
Please review by comparing against the files of origin (keep in mind what the related PRs are changing): https://github.com/dotnet/dotnet-api-docs/tree/master/xml/System.IO.Compression