Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/libraries/System.Formats.Tar/ref/System.Formats.Tar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ internal TarEntry() { }
public void ExtractToFile(string destinationFileName, bool overwrite) { }
public override string ToString() { throw null; }
}
public enum TarEntryFormat
{
Unknown = 0,
V7 = 1,
Ustar = 2,
Pax = 3,
Gnu = 4,
}
public enum TarEntryType : byte
{
V7RegularFile = (byte)0,
Expand Down Expand Up @@ -87,27 +95,19 @@ public enum TarFileMode
GroupSpecial = 1024,
UserSpecial = 2048,
}
public enum TarFormat
{
Unknown = 0,
V7 = 1,
Ustar = 2,
Pax = 3,
Gnu = 4,
}
public sealed partial class TarReader : System.IDisposable
{
public TarReader(System.IO.Stream archiveStream, bool leaveOpen = false) { }
public System.Formats.Tar.TarFormat Format { get { throw null; } }
public System.Formats.Tar.TarEntryFormat Format { get { throw null; } }
public System.Collections.Generic.IReadOnlyDictionary<string, string>? GlobalExtendedAttributes { get { throw null; } }
public void Dispose() { }
public System.Formats.Tar.TarEntry? GetNextEntry(bool copyData = false) { throw null; }
}
public sealed partial class TarWriter : System.IDisposable
{
public TarWriter(System.IO.Stream archiveStream, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>? globalExtendedAttributes = null, bool leaveOpen = false) { }
public TarWriter(System.IO.Stream archiveStream, System.Formats.Tar.TarFormat archiveFormat, bool leaveOpen = false) { }
public System.Formats.Tar.TarFormat Format { get { throw null; } }
public TarWriter(System.IO.Stream archiveStream, System.Formats.Tar.TarEntryFormat archiveFormat, bool leaveOpen = false) { }
public System.Formats.Tar.TarEntryFormat Format { get { throw null; } }
public void Dispose() { }
public void WriteEntry(System.Formats.Tar.TarEntry entry) { }
public void WriteEntry(string fileName, string? entryName) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
<Compile Include="System\Formats\Tar\TarHeader.Write.cs" />
<Compile Include="System\Formats\Tar\TarHelpers.cs" />
<Compile Include="System\Formats\Tar\TarEntry.cs" />
<Compile Include="System\Formats\Tar\TarEntryFormat.cs" />
<Compile Include="System\Formats\Tar\UstarTarEntry.cs" />
<Compile Include="System\Formats\Tar\GnuTarEntry.cs" />
<Compile Include="System\Formats\Tar\PaxTarEntry.cs" />
<Compile Include="System\Formats\Tar\TarEntryType.cs" />
<Compile Include="System\Formats\Tar\TarFile.cs" />
<Compile Include="System\Formats\Tar\TarFormat.cs" />
<Compile Include="System\Formats\Tar\TarReader.cs" />
<Compile Include="System\Formats\Tar\TarWriter.cs" />
<Compile Include="System\Formats\Tar\SubReadStream.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace System.Formats.Tar
/// <summary>
/// Represents a tar entry from an archive of the GNU format.
/// </summary>
/// <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>
/// <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>
public sealed class GnuTarEntry : PosixTarEntry
{
// Constructor used when reading an existing archive.
Expand All @@ -29,7 +29,7 @@ internal GnuTarEntry(TarHeader header, TarReader readerOfOrigin)
/// </list>
/// </remarks>
public GnuTarEntry(TarEntryType entryType, string entryName)
: base(entryType, entryName, TarFormat.Gnu)
: base(entryType, entryName, TarEntryFormat.Gnu)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal PaxTarEntry(TarHeader header, TarReader readerOfOrigin)
/// </list>
/// </remarks>
public PaxTarEntry(TarEntryType entryType, string entryName)
: base(entryType, entryName, TarFormat.Pax)
: base(entryType, entryName, TarEntryFormat.Pax)
{
}

Expand Down Expand Up @@ -84,7 +84,7 @@ public PaxTarEntry(TarEntryType entryType, string entryName)
/// </list>
/// </remarks>
public PaxTarEntry(TarEntryType entryType, string entryName, IEnumerable<KeyValuePair<string, string>> extendedAttributes)
: base(entryType, entryName, TarFormat.Pax)
: base(entryType, entryName, TarEntryFormat.Pax)
{
ArgumentNullException.ThrowIfNull(extendedAttributes);
_header.ReplaceNormalAttributesWithExtended(extendedAttributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
namespace System.Formats.Tar
{
/// <summary>
/// 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).
/// 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).
/// </summary>
/// <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>.
/// 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>
/// 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>
public abstract partial class PosixTarEntry : TarEntry
{
// Constructor used when reading an existing archive.
Expand All @@ -17,7 +17,7 @@ internal PosixTarEntry(TarHeader header, TarReader readerOfOrigin)
}

// Constructor called when creating a new 'TarEntry*' instance that can be passed to a TarWriter.
internal PosixTarEntry(TarEntryType entryType, string entryName, TarFormat format)
internal PosixTarEntry(TarEntryType entryType, string entryName, TarEntryFormat format)
: base(entryType, entryName, format)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace System.Formats.Tar
/// <summary>
/// Abstract class that represents a tar entry from an archive.
/// </summary>
/// <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>
/// <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>
public abstract partial class TarEntry
{
internal TarHeader _header;
Expand All @@ -26,7 +26,7 @@ internal TarEntry(TarHeader header, TarReader readerOfOrigin)
}

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

Expand Down Expand Up @@ -93,7 +93,7 @@ public DateTimeOffset ModificationTime
/// <summary>
/// When the <see cref="EntryType"/> indicates an entry that can contain data, this property returns the length in bytes of such data.
/// </summary>
/// <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>
/// <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>
public long Length => _header._dataStream != null ? _header._dataStream.Length : _header._size;

/// <summary>
Expand Down Expand Up @@ -211,7 +211,7 @@ public void ExtractToFile(string destinationFileName, bool overwrite)
/// <value><para>Gets a stream that represents the data section of this entry.</para>
/// <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>
/// <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>
/// <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>
/// <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>
/// <exception cref="IOException"><para>Cannot set an unreadable stream.</para>
/// <para>-or-</para>
/// <para>An I/O problem occurred.</para></exception>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
namespace System.Formats.Tar
{
/// <summary>
/// Specifies the supported Tar formats.
/// Specifies the supported formats that tar entries can use.
/// </summary>
public enum TarFormat
public enum TarEntryFormat
{
/// <summary>
/// Tar format undetermined.
/// Tar entry format undetermined.
/// </summary>
Unknown,
/// <summary>
/// 1979 Version 7 AT&amp;T Unix Tar Command Format (v7).
/// 1979 Version 7 AT&amp;T Unix tar entry format.
/// </summary>
V7,
/// <summary>
/// POSIX IEEE 1003.1-1988 Unix Standard Tar Format (ustar).
/// POSIX IEEE 1003.1-1988 Unix Standard tar entry format.
/// </summary>
Ustar,
/// <summary>
/// POSIX IEEE 1003.1-2001 ("POSIX.1") Pax Interchange Tar Format (pax).
/// POSIX IEEE 1003.1-2001 ("POSIX.1") Pax Interchange tar entry format.
/// </summary>
Pax,
/// <summary>
/// GNU Tar Format (gnu).
/// GNU tar entry format (gnu).
/// </summary>
Gnu,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public enum TarEntryType : byte
{
/// <summary>
/// <para>Regular file.</para>
/// <para>This entry type is specific to the <see cref="TarFormat.Ustar"/>, <see cref="TarFormat.Pax"/> and <see cref="TarFormat.Gnu"/> formats.</para>
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Ustar"/>, <see cref="TarEntryFormat.Pax"/> and <see cref="TarEntryFormat.Gnu"/> formats.</para>
/// </summary>
RegularFile = (byte)'0',
/// <summary>
Expand Down Expand Up @@ -43,7 +43,7 @@ public enum TarEntryType : byte
Fifo = (byte)'6',
/// <summary>
/// <para>GNU contiguous file</para>
/// <para>This entry type is specific to the <see cref="TarFormat.Gnu"/> format, and is treated as a <see cref="RegularFile"/> entry type.</para>
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Gnu"/> format, and is treated as a <see cref="RegularFile"/> entry type.</para>
/// </summary>
// According to the GNU spec, it's extremely rare to encounter a contiguous entry.
ContiguousFile = (byte)'7',
Expand All @@ -59,7 +59,7 @@ public enum TarEntryType : byte
GlobalExtendedAttributes = (byte)'g',
/// <summary>
/// <para>GNU directory with a list of entries.</para>
/// <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>
/// <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>
/// </summary>
DirectoryList = (byte)'D',
/// <summary>
Expand All @@ -74,27 +74,27 @@ public enum TarEntryType : byte
LongPath = (byte)'L',
/// <summary>
/// <para>GNU multi-volume file.</para>
/// <para>This entry type is specific to the <see cref="TarFormat.Gnu"/> format and is not supported for writing.</para>
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Gnu"/> format and is not supported for writing.</para>
/// </summary>
MultiVolume = (byte)'M',
/// <summary>
/// <para>V7 Regular file.</para>
/// <para>This entry type is specific to the <see cref="TarFormat.V7"/> format.</para>
/// <para>This entry type is specific to the <see cref="TarEntryFormat.V7"/> format.</para>
/// </summary>
V7RegularFile = (byte)'\0',
/// <summary>
/// <para>GNU file to be renamed/symlinked.</para>
/// <para>This entry type is specific to the <see cref="TarFormat.Gnu"/> format. It is considered unsafe and is ignored by other tools.</para>
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Gnu"/> format. It is considered unsafe and is ignored by other tools.</para>
/// </summary>
RenamedOrSymlinked = (byte)'N',
/// <summary>
/// <para>GNU sparse file.</para>
/// <para>This entry type is specific to the <see cref="TarFormat.Gnu"/> format and is not supported for writing.</para>
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Gnu"/> format and is not supported for writing.</para>
/// </summary>
SparseFile = (byte)'S',
/// <summary>
/// <para>GNU tape volume.</para>
/// <para>This entry type is specific to the <see cref="TarFormat.Gnu"/> format and is not supported for writing.</para>
/// <para>This entry type is specific to the <see cref="TarEntryFormat.Gnu"/> format and is not supported for writing.</para>
/// </summary>
TapeVolume = (byte)'V',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private static void CreateFromDirectoryInternal(string sourceDirectoryName, Stre
Debug.Assert(Path.IsPathFullyQualified(sourceDirectoryName));
Debug.Assert(destination.CanWrite);

using (TarWriter writer = new TarWriter(destination, TarFormat.Pax, leaveOpen))
using (TarWriter writer = new TarWriter(destination, TarEntryFormat.Pax, leaveOpen))
{
bool baseDirectoryIsEmpty = true;
DirectoryInfo di = new(sourceDirectoryName);
Expand Down
Loading