Skip to content

Commit 209deaf

Browse files
committed
System.IO.Compression docs
1 parent 8313f62 commit 209deaf

File tree

4 files changed

+895
-133
lines changed

4 files changed

+895
-133
lines changed

xml/System.IO.Compression/ZipArchive.xml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,30 @@ If the comment byte length is larger than <xref:System.UInt16.MaxValue>, it will
384384
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="4" FrameworkAlternate="net-10.0" />
385385
</Parameters>
386386
<Docs>
387-
<param name="stream">To be added.</param>
388-
<param name="mode">To be added.</param>
389-
<param name="leaveOpen">To be added.</param>
390-
<param name="entryNameEncoding">To be added.</param>
391-
<param name="cancellationToken">To be added.</param>
392-
<summary>To be added.</summary>
387+
<param name="stream">The input or output stream.</param>
388+
<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>
389+
<param name="leaveOpen">
390+
<see langword="true" /> to leave the stream open upon disposing the ZipArchive, otherwise <see langword="false" />.</param>
391+
<param name="entryNameEncoding">&lt;para&gt;The encoding to use when reading or writing entry names and comments in this ZipArchive.&lt;/para&gt;&lt;para&gt;/// &lt;para&gt;NOTE: Specifying this parameter to values other than &lt;see langword="null" /&gt; is discouraged.&lt;/para&gt;&lt;para&gt;However, this may be necessary for interoperability with ZIP archive tools and libraries that do not correctly support UTF-8 encoding for entry names.&lt;br /&gt; This value is used as follows:&lt;/para&gt;&lt;para&gt; &lt;strong&gt;Reading (opening) ZIP archive files:&lt;/strong&gt; &lt;/para&gt;&lt;para&gt;If &lt;c&gt;entryNameEncoding&lt;/c&gt; is not specified (&lt;c&gt;== null&lt;/c&gt;):&lt;/para&gt;&lt;list&gt; &lt;item&gt;For entries where the language encoding flag (EFS) in the general purpose bit flag of the local file header is &lt;em&gt;not&lt;/em&gt; set, use the current system default code page (&lt;c&gt;Encoding.Default&lt;/c&gt;) in order to decode the entry name and comment.&lt;/item&gt; &lt;item&gt;For entries where the language encoding flag (EFS) in the general purpose bit flag of the local file header &lt;em&gt;is&lt;/em&gt; set, use UTF-8 (&lt;c&gt;Encoding.UTF8&lt;/c&gt;) in order to decode the entry name and comment.&lt;/item&gt; &lt;/list&gt;&lt;para&gt;If &lt;c&gt;entryNameEncoding&lt;/c&gt; is specified (&lt;c&gt;!= null&lt;/c&gt;):&lt;/para&gt;&lt;list&gt; &lt;item&gt;For entries where the language encoding flag (EFS) in the general purpose bit flag of the local file header is &lt;em&gt;not&lt;/em&gt; set, use the specified &lt;c&gt;entryNameEncoding&lt;/c&gt; in order to decode the entry name and comment.&lt;/item&gt; &lt;item&gt;For entries where the language encoding flag (EFS) in the general purpose bit flag of the local file header &lt;em&gt;is&lt;/em&gt; set, use UTF-8 (&lt;c&gt;Encoding.UTF8&lt;/c&gt;) in order to decode the entry name and comment.&lt;/item&gt; &lt;/list&gt;&lt;para&gt; &lt;strong&gt;Writing (saving) ZIP archive files:&lt;/strong&gt; &lt;/para&gt;&lt;para&gt;If &lt;c&gt;entryNameEncoding&lt;/c&gt; is not specified (&lt;c&gt;== null&lt;/c&gt;):&lt;/para&gt;&lt;list&gt; &lt;item&gt;For entry names and comments that contain characters outside the ASCII range, the language encoding flag (EFS) will be set in the general purpose bit flag of the local file header, and UTF-8 (&lt;c&gt;Encoding.UTF8&lt;/c&gt;) will be used in order to encode the entry name and comment into bytes.&lt;/item&gt; &lt;item&gt;For entry names and comments that do not contain characters outside the ASCII range, the language encoding flag (EFS) will not be set in the general purpose bit flag of the local file header, and the current system default code page (&lt;c&gt;Encoding.Default&lt;/c&gt;) will be used to encode the entry names and comments into bytes.&lt;/item&gt; &lt;/list&gt;&lt;para&gt;If &lt;c&gt;entryNameEncoding&lt;/c&gt; is specified (&lt;c&gt;!= null&lt;/c&gt;):&lt;/para&gt;&lt;list&gt; &lt;item&gt;The specified &lt;c&gt;entryNameEncoding&lt;/c&gt; will always be used to encode the entry names and comments into bytes.&lt;/para&gt;&lt;para&gt;The language encoding flag (EFS) in the general purpose bit flag of the local file header will be set if and only if the specified &lt;c&gt;entryNameEncoding&lt;/c&gt; is a UTF-8 encoding.&lt;/item&gt; &lt;/list&gt;&lt;para&gt;Note that Unicode encodings other than UTF-8 may not be currently used for the &lt;c&gt;entryNameEncoding&lt;/c&gt;, otherwise an &lt;see cref="T:System.ArgumentException" /&gt; is thrown.&lt;/para&gt;</param>
392+
<param name="cancellationToken">The optional cancellation token to monitor.</param>
393+
<summary>Asynchronously initializes and returns a new instance of <see cref="T:System.IO.Compression.ZipArchive" /> on the given stream in the specified mode, specifying whether to leave the stream open, with an optional encoding and an optional cancellation token.</summary>
393394
<returns>To be added.</returns>
394395
<remarks>To be added.</remarks>
396+
<exception cref="T:System.ArgumentException">
397+
<para>The stream is already closed.</para>
398+
<para>-or-</para>
399+
<para>mode is incompatible with the capabilities of the stream.</para>
400+
</exception>
401+
<exception cref="T:System.ArgumentNullException">The stream is <see langword="null" />.</exception>
402+
<exception cref="T:System.ArgumentOutOfRangeException">mode specified an invalid value.</exception>
403+
<exception cref="T:System.IO.InvalidDataException">
404+
<para>The contents of the stream could not be interpreted as a Zip file.</para>
405+
<para>-or-</para>
406+
<para>mode is Update and an entry is missing from the archive or is corrupt and cannot be read.</para>
407+
<para>-or-</para>
408+
<para>mode is Update and an entry is too large to fit into memory.</para>
409+
</exception>
410+
<exception cref="T:System.ArgumentException">If a Unicode encoding other than UTF-8 is specified for the <code>entryNameEncoding</code>.</exception>
395411
</Docs>
396412
</Member>
397413
<MemberGroup MemberName="CreateEntry">

xml/System.IO.Compression/ZipArchiveEntry.xml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,23 @@ If the comment byte length is larger than <xref:System.UInt16.MaxValue>, it will
590590
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="0" FrameworkAlternate="net-10.0" />
591591
</Parameters>
592592
<Docs>
593-
<param name="cancellationToken">To be added.</param>
594-
<summary>To be added.</summary>
595-
<returns>To be added.</returns>
593+
<param name="cancellationToken">The token to monitor for cancellation requests.</param>
594+
<summary>Asynchronously 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.</summary>
595+
<returns>A Stream that represents the contents of the entry.</returns>
596596
<remarks>To be added.</remarks>
597+
<exception cref="T:System.IO.IOException">
598+
<para>The entry is already currently open for writing.</para>
599+
<para>-or-</para>
600+
<para>The entry has been deleted from the archive.</para>
601+
<para>-or-</para>
602+
<para>The archive that this entry belongs to was opened in ZipArchiveMode.Create, and this entry has already been written to once.</para>
603+
</exception>
604+
<exception cref="T:System.IO.InvalidDataException">
605+
<para>The entry is missing from the archive or is corrupt and cannot be read.</para>
606+
<para>-or-</para>
607+
<para>The entry has been compressed using a compression method that is not supported.</para>
608+
</exception>
609+
<exception cref="T:System.ObjectDisposedException">The ZipArchive that this entry belongs to has been disposed.</exception>
597610
</Docs>
598611
</Member>
599612
<Member MemberName="ToString">

0 commit comments

Comments
 (0)