Skip to content

Commit 0a7db6e

Browse files
authored
Rename TarFormat to TarEntryFormat (#70313)
1 parent a40b002 commit 0a7db6e

31 files changed

+333
-333
lines changed

src/libraries/System.Formats.Tar/ref/System.Formats.Tar.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ internal TarEntry() { }
4242
public void ExtractToFile(string destinationFileName, bool overwrite) { }
4343
public override string ToString() { throw null; }
4444
}
45+
public enum TarEntryFormat
46+
{
47+
Unknown = 0,
48+
V7 = 1,
49+
Ustar = 2,
50+
Pax = 3,
51+
Gnu = 4,
52+
}
4553
public enum TarEntryType : byte
4654
{
4755
V7RegularFile = (byte)0,
@@ -87,27 +95,19 @@ public enum TarFileMode
8795
GroupSpecial = 1024,
8896
UserSpecial = 2048,
8997
}
90-
public enum TarFormat
91-
{
92-
Unknown = 0,
93-
V7 = 1,
94-
Ustar = 2,
95-
Pax = 3,
96-
Gnu = 4,
97-
}
9898
public sealed partial class TarReader : System.IDisposable
9999
{
100100
public TarReader(System.IO.Stream archiveStream, bool leaveOpen = false) { }
101-
public System.Formats.Tar.TarFormat Format { get { throw null; } }
101+
public System.Formats.Tar.TarEntryFormat Format { get { throw null; } }
102102
public System.Collections.Generic.IReadOnlyDictionary<string, string>? GlobalExtendedAttributes { get { throw null; } }
103103
public void Dispose() { }
104104
public System.Formats.Tar.TarEntry? GetNextEntry(bool copyData = false) { throw null; }
105105
}
106106
public sealed partial class TarWriter : System.IDisposable
107107
{
108108
public TarWriter(System.IO.Stream archiveStream, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>? globalExtendedAttributes = null, bool leaveOpen = false) { }
109-
public TarWriter(System.IO.Stream archiveStream, System.Formats.Tar.TarFormat archiveFormat, bool leaveOpen = false) { }
110-
public System.Formats.Tar.TarFormat Format { get { throw null; } }
109+
public TarWriter(System.IO.Stream archiveStream, System.Formats.Tar.TarEntryFormat archiveFormat, bool leaveOpen = false) { }
110+
public System.Formats.Tar.TarEntryFormat Format { get { throw null; } }
111111
public void Dispose() { }
112112
public void WriteEntry(System.Formats.Tar.TarEntry entry) { }
113113
public void WriteEntry(string fileName, string? entryName) { }

src/libraries/System.Formats.Tar/src/System.Formats.Tar.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
<Compile Include="System\Formats\Tar\TarHeader.Write.cs" />
2222
<Compile Include="System\Formats\Tar\TarHelpers.cs" />
2323
<Compile Include="System\Formats\Tar\TarEntry.cs" />
24+
<Compile Include="System\Formats\Tar\TarEntryFormat.cs" />
2425
<Compile Include="System\Formats\Tar\UstarTarEntry.cs" />
2526
<Compile Include="System\Formats\Tar\GnuTarEntry.cs" />
2627
<Compile Include="System\Formats\Tar\PaxTarEntry.cs" />
2728
<Compile Include="System\Formats\Tar\TarEntryType.cs" />
2829
<Compile Include="System\Formats\Tar\TarFile.cs" />
29-
<Compile Include="System\Formats\Tar\TarFormat.cs" />
3030
<Compile Include="System\Formats\Tar\TarReader.cs" />
3131
<Compile Include="System\Formats\Tar\TarWriter.cs" />
3232
<Compile Include="System\Formats\Tar\SubReadStream.cs" />

src/libraries/System.Formats.Tar/src/System/Formats/Tar/GnuTarEntry.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace System.Formats.Tar
66
/// <summary>
77
/// Represents a tar entry from an archive of the GNU format.
88
/// </summary>
9-
/// <remarks>Even though the <see cref="TarFormat.Gnu"/> format is not POSIX compatible, it implements and supports the Unix-specific fields that were defined in the POSIX IEEE P1003.1 standard from 1988: <c>devmajor</c>, <c>devminor</c>, <c>gname</c> and <c>uname</c>.</remarks>
9+
/// <remarks>Even though the <see cref="TarEntryFormat.Gnu"/> format is not POSIX compatible, it implements and supports the Unix-specific fields that were defined in the POSIX IEEE P1003.1 standard from 1988: <c>devmajor</c>, <c>devminor</c>, <c>gname</c> and <c>uname</c>.</remarks>
1010
public sealed class GnuTarEntry : PosixTarEntry
1111
{
1212
// Constructor used when reading an existing archive.
@@ -29,7 +29,7 @@ internal GnuTarEntry(TarHeader header, TarReader readerOfOrigin)
2929
/// </list>
3030
/// </remarks>
3131
public GnuTarEntry(TarEntryType entryType, string entryName)
32-
: base(entryType, entryName, TarFormat.Gnu)
32+
: base(entryType, entryName, TarEntryFormat.Gnu)
3333
{
3434
}
3535

src/libraries/System.Formats.Tar/src/System/Formats/Tar/PaxTarEntry.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ internal PaxTarEntry(TarHeader header, TarReader readerOfOrigin)
5050
/// </list>
5151
/// </remarks>
5252
public PaxTarEntry(TarEntryType entryType, string entryName)
53-
: base(entryType, entryName, TarFormat.Pax)
53+
: base(entryType, entryName, TarEntryFormat.Pax)
5454
{
5555
}
5656

@@ -84,7 +84,7 @@ public PaxTarEntry(TarEntryType entryType, string entryName)
8484
/// </list>
8585
/// </remarks>
8686
public PaxTarEntry(TarEntryType entryType, string entryName, IEnumerable<KeyValuePair<string, string>> extendedAttributes)
87-
: base(entryType, entryName, TarFormat.Pax)
87+
: base(entryType, entryName, TarEntryFormat.Pax)
8888
{
8989
ArgumentNullException.ThrowIfNull(extendedAttributes);
9090
_header.ReplaceNormalAttributesWithExtended(extendedAttributes);

src/libraries/System.Formats.Tar/src/System/Formats/Tar/PosixTarEntry.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
namespace System.Formats.Tar
55
{
66
/// <summary>
7-
/// Abstract class that represents a tar entry from an archive of a format that is based on the POSIX IEEE P1003.1 standard from 1988. This includes the formats <see cref="TarFormat.Ustar"/> (represented by the <see cref="UstarTarEntry"/> class), <see cref="TarFormat.Pax"/> (represented by the <see cref="PaxTarEntry"/> class) and <see cref="TarFormat.Gnu"/> (represented by the <see cref="GnuTarEntry"/> class).
7+
/// Abstract class that represents a tar entry from an archive of a format that is based on the POSIX IEEE P1003.1 standard from 1988. This includes the formats <see cref="TarEntryFormat.Ustar"/> (represented by the <see cref="UstarTarEntry"/> class), <see cref="TarEntryFormat.Pax"/> (represented by the <see cref="PaxTarEntry"/> class) and <see cref="TarEntryFormat.Gnu"/> (represented by the <see cref="GnuTarEntry"/> class).
88
/// </summary>
99
/// <remarks>Formats that implement the POSIX IEEE P1003.1 standard from 1988, support the following header fields: <c>devmajor</c>, <c>devminor</c>, <c>gname</c> and <c>uname</c>.
10-
/// Even though the <see cref="TarFormat.Gnu"/> format is not POSIX compatible, it implements and supports the Unix-specific fields that were defined in that POSIX standard.</remarks>
10+
/// Even though the <see cref="TarEntryFormat.Gnu"/> format is not POSIX compatible, it implements and supports the Unix-specific fields that were defined in that POSIX standard.</remarks>
1111
public abstract partial class PosixTarEntry : TarEntry
1212
{
1313
// Constructor used when reading an existing archive.
@@ -17,7 +17,7 @@ internal PosixTarEntry(TarHeader header, TarReader readerOfOrigin)
1717
}
1818

1919
// Constructor called when creating a new 'TarEntry*' instance that can be passed to a TarWriter.
20-
internal PosixTarEntry(TarEntryType entryType, string entryName, TarFormat format)
20+
internal PosixTarEntry(TarEntryType entryType, string entryName, TarEntryFormat format)
2121
: base(entryType, entryName, format)
2222
{
2323
}

src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarEntry.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace System.Formats.Tar
1111
/// <summary>
1212
/// Abstract class that represents a tar entry from an archive.
1313
/// </summary>
14-
/// <remarks>All the properties exposed by this class are supported by the <see cref="TarFormat.V7"/>, <see cref="TarFormat.Ustar"/>, <see cref="TarFormat.Pax"/> and <see cref="TarFormat.Gnu"/> formats.</remarks>
14+
/// <remarks>All the properties exposed by this class are supported by the <see cref="TarEntryFormat.V7"/>, <see cref="TarEntryFormat.Ustar"/>, <see cref="TarEntryFormat.Pax"/> and <see cref="TarEntryFormat.Gnu"/> formats.</remarks>
1515
public abstract partial class TarEntry
1616
{
1717
internal TarHeader _header;
@@ -26,7 +26,7 @@ internal TarEntry(TarHeader header, TarReader readerOfOrigin)
2626
}
2727

2828
// Constructor called when creating a new 'TarEntry*' instance that can be passed to a TarWriter.
29-
internal TarEntry(TarEntryType entryType, string entryName, TarFormat format)
29+
internal TarEntry(TarEntryType entryType, string entryName, TarEntryFormat format)
3030
{
3131
ArgumentException.ThrowIfNullOrEmpty(entryName);
3232

@@ -93,7 +93,7 @@ public DateTimeOffset ModificationTime
9393
/// <summary>
9494
/// When the <see cref="EntryType"/> indicates an entry that can contain data, this property returns the length in bytes of such data.
9595
/// </summary>
96-
/// <remarks>The entry type that commonly contains data is <see cref="TarEntryType.RegularFile"/> (or <see cref="TarEntryType.V7RegularFile"/> in the <see cref="TarFormat.V7"/> format). Other uncommon entry types that can also contain data are: <see cref="TarEntryType.ContiguousFile"/>, <see cref="TarEntryType.DirectoryList"/>, <see cref="TarEntryType.MultiVolume"/> and <see cref="TarEntryType.SparseFile"/>.</remarks>
96+
/// <remarks>The entry type that commonly contains data is <see cref="TarEntryType.RegularFile"/> (or <see cref="TarEntryType.V7RegularFile"/> in the <see cref="TarEntryFormat.V7"/> format). Other uncommon entry types that can also contain data are: <see cref="TarEntryType.ContiguousFile"/>, <see cref="TarEntryType.DirectoryList"/>, <see cref="TarEntryType.MultiVolume"/> and <see cref="TarEntryType.SparseFile"/>.</remarks>
9797
public long Length => _header._dataStream != null ? _header._dataStream.Length : _header._size;
9898

9999
/// <summary>
@@ -211,7 +211,7 @@ public void ExtractToFile(string destinationFileName, bool overwrite)
211211
/// <value><para>Gets a stream that represents the data section of this entry.</para>
212212
/// <para>Sets a new stream that represents the data section, if it makes sense for the <see cref="EntryType"/> to contain data; if a stream already existed, the old stream gets disposed before substituting it with the new stream. Setting a <see langword="null"/> stream is allowed.</para></value>
213213
/// <remarks>If you write data to this data stream, make sure to rewind it to the desired start position before writing this entry into an archive using <see cref="TarWriter.WriteEntry(TarEntry)"/>.</remarks>
214-
/// <exception cref="InvalidOperationException">Setting a data section is not supported because the <see cref="EntryType"/> is not <see cref="TarEntryType.RegularFile"/> (or <see cref="TarEntryType.V7RegularFile"/> for an archive of <see cref="TarFormat.V7"/> format).</exception>
214+
/// <exception cref="InvalidOperationException">Setting a data section is not supported because the <see cref="EntryType"/> is not <see cref="TarEntryType.RegularFile"/> (or <see cref="TarEntryType.V7RegularFile"/> for an archive of <see cref="TarEntryFormat.V7"/> format).</exception>
215215
/// <exception cref="IOException"><para>Cannot set an unreadable stream.</para>
216216
/// <para>-or-</para>
217217
/// <para>An I/O problem occurred.</para></exception>

src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarFormat.cs renamed to src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarEntryFormat.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@
44
namespace System.Formats.Tar
55
{
66
/// <summary>
7-
/// Specifies the supported Tar formats.
7+
/// Specifies the supported formats that tar entries can use.
88
/// </summary>
9-
public enum TarFormat
9+
public enum TarEntryFormat
1010
{
1111
/// <summary>
12-
/// Tar format undetermined.
12+
/// Tar entry format undetermined.
1313
/// </summary>
1414
Unknown,
1515
/// <summary>
16-
/// 1979 Version 7 AT&amp;T Unix Tar Command Format (v7).
16+
/// 1979 Version 7 AT&amp;T Unix tar entry format.
1717
/// </summary>
1818
V7,
1919
/// <summary>
20-
/// POSIX IEEE 1003.1-1988 Unix Standard Tar Format (ustar).
20+
/// POSIX IEEE 1003.1-1988 Unix Standard tar entry format.
2121
/// </summary>
2222
Ustar,
2323
/// <summary>
24-
/// POSIX IEEE 1003.1-2001 ("POSIX.1") Pax Interchange Tar Format (pax).
24+
/// POSIX IEEE 1003.1-2001 ("POSIX.1") Pax Interchange tar entry format.
2525
/// </summary>
2626
Pax,
2727
/// <summary>
28-
/// GNU Tar Format (gnu).
28+
/// GNU tar entry format (gnu).
2929
/// </summary>
3030
Gnu,
3131
}

src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarEntryType.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public enum TarEntryType : byte
1111
{
1212
/// <summary>
1313
/// <para>Regular file.</para>
14-
/// <para>This entry type is specific to the <see cref="TarFormat.Ustar"/>, <see cref="TarFormat.Pax"/> and <see cref="TarFormat.Gnu"/> formats.</para>
14+
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Ustar"/>, <see cref="TarEntryFormat.Pax"/> and <see cref="TarEntryFormat.Gnu"/> formats.</para>
1515
/// </summary>
1616
RegularFile = (byte)'0',
1717
/// <summary>
@@ -43,7 +43,7 @@ public enum TarEntryType : byte
4343
Fifo = (byte)'6',
4444
/// <summary>
4545
/// <para>GNU contiguous file</para>
46-
/// <para>This entry type is specific to the <see cref="TarFormat.Gnu"/> format, and is treated as a <see cref="RegularFile"/> entry type.</para>
46+
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Gnu"/> format, and is treated as a <see cref="RegularFile"/> entry type.</para>
4747
/// </summary>
4848
// According to the GNU spec, it's extremely rare to encounter a contiguous entry.
4949
ContiguousFile = (byte)'7',
@@ -59,7 +59,7 @@ public enum TarEntryType : byte
5959
GlobalExtendedAttributes = (byte)'g',
6060
/// <summary>
6161
/// <para>GNU directory with a list of entries.</para>
62-
/// <para>This entry type is specific to the <see cref="TarFormat.Gnu"/> format, and is treated as a <see cref="Directory"/> entry type that contains a data section.</para>
62+
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Gnu"/> format, and is treated as a <see cref="Directory"/> entry type that contains a data section.</para>
6363
/// </summary>
6464
DirectoryList = (byte)'D',
6565
/// <summary>
@@ -74,27 +74,27 @@ public enum TarEntryType : byte
7474
LongPath = (byte)'L',
7575
/// <summary>
7676
/// <para>GNU multi-volume file.</para>
77-
/// <para>This entry type is specific to the <see cref="TarFormat.Gnu"/> format and is not supported for writing.</para>
77+
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Gnu"/> format and is not supported for writing.</para>
7878
/// </summary>
7979
MultiVolume = (byte)'M',
8080
/// <summary>
8181
/// <para>V7 Regular file.</para>
82-
/// <para>This entry type is specific to the <see cref="TarFormat.V7"/> format.</para>
82+
/// <para>This entry type is specific to the <see cref="TarEntryFormat.V7"/> format.</para>
8383
/// </summary>
8484
V7RegularFile = (byte)'\0',
8585
/// <summary>
8686
/// <para>GNU file to be renamed/symlinked.</para>
87-
/// <para>This entry type is specific to the <see cref="TarFormat.Gnu"/> format. It is considered unsafe and is ignored by other tools.</para>
87+
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Gnu"/> format. It is considered unsafe and is ignored by other tools.</para>
8888
/// </summary>
8989
RenamedOrSymlinked = (byte)'N',
9090
/// <summary>
9191
/// <para>GNU sparse file.</para>
92-
/// <para>This entry type is specific to the <see cref="TarFormat.Gnu"/> format and is not supported for writing.</para>
92+
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Gnu"/> format and is not supported for writing.</para>
9393
/// </summary>
9494
SparseFile = (byte)'S',
9595
/// <summary>
9696
/// <para>GNU tape volume.</para>
97-
/// <para>This entry type is specific to the <see cref="TarFormat.Gnu"/> format and is not supported for writing.</para>
97+
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Gnu"/> format and is not supported for writing.</para>
9898
/// </summary>
9999
TapeVolume = (byte)'V',
100100
}

src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarFile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private static void CreateFromDirectoryInternal(string sourceDirectoryName, Stre
196196
Debug.Assert(Path.IsPathFullyQualified(sourceDirectoryName));
197197
Debug.Assert(destination.CanWrite);
198198

199-
using (TarWriter writer = new TarWriter(destination, TarFormat.Pax, leaveOpen))
199+
using (TarWriter writer = new TarWriter(destination, TarEntryFormat.Pax, leaveOpen))
200200
{
201201
bool baseDirectoryIsEmpty = true;
202202
DirectoryInfo di = new(sourceDirectoryName);

0 commit comments

Comments
 (0)