244 references to TarEntryFormat
Microsoft.NET.Build.Containers (4)
Layer.cs (1)
96
using (TarWriter writer = new(gz,
TarEntryFormat
.Pax, leaveOpen: true))
LocalDaemons\DockerCli.cs (3)
403
using TarWriter writer = new(imageStream,
TarEntryFormat
.Pax, leaveOpen: true);
510
using TarWriter writer = new(imageStream,
TarEntryFormat
.Pax, leaveOpen: true);
606
using TarWriter writer = new(imageStream,
TarEntryFormat
.Pax, leaveOpen: true);
System.Formats.Tar (240)
System\Formats\Tar\GnuTarEntry.cs (14)
11
/// <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>
16
: base(header, readerOfOrigin,
TarEntryFormat
.Gnu)
26
/// <para>When creating an instance of <see cref="GnuTarEntry"/> using this constructor, the <see cref="AccessTime"/> and <see cref="ChangeTime"/> properties are set to <see langword="default" />, which in the entry header <c>atime</c> and <c>ctime</c> fields is written as null bytes. This ensures compatibility with other tools that are unable to read the <c>atime</c> and <c>ctime</c> in <see cref="
TarEntryFormat
.Gnu"/> entries, as these two fields are not POSIX compatible because other formats expect the <c>prefix</c> field in the same header location where <see cref="
TarEntryFormat
.Gnu"/> writes <c>atime</c> and <c>ctime</c>.</para>
38
: base(entryType, entryName,
TarEntryFormat
.Gnu, isGea: false)
45
/// <para>When creating an instance of <see cref="GnuTarEntry"/> using this constructor, if <paramref name="other"/> is <see cref="
TarEntryFormat
.Gnu"/> or <see cref="
TarEntryFormat
.Pax"/>, then the <see cref="AccessTime"/> and <see cref="ChangeTime"/> properties are set to the same values set in <paramref name="other"/>. But if <paramref name="other"/> is of any other format, then <see cref="AccessTime"/> and <see cref="ChangeTime"/> are set to <see langword="default" />, which in the entry header <c>atime</c> and <c>ctime</c> fields is written as null bytes. This ensures compatibility with other tools that are unable to read the <c>atime</c> and <c>ctime</c> in <see cref="
TarEntryFormat
.Gnu"/> entries, as these two fields are not POSIX compatible because other formats expect the <c>prefix</c> field in the same header location where <see cref="
TarEntryFormat
.Gnu"/> writes <c>atime</c> and <c>ctime</c>.</para>
51
: base(other,
TarEntryFormat
.Gnu)
72
/// <para>Setting the value of this property to a value other than <see langword="default"/> may cause problems with other tools that read TAR files, because the <see cref="
TarEntryFormat
.Gnu"/> format writes the <c>atime</c> field where other formats would normally read and write the <c>prefix</c> field in the header. You should only set this property to something other than <see langword="default"/> if this entry will be read by tools that know how to correctly interpret the <c>atime</c> field of the <see cref="
TarEntryFormat
.Gnu"/> format.</para>
88
/// <para>Setting the value of this property to a value other than <see langword="default"/> may cause problems with other tools that read TAR files, because the <see cref="
TarEntryFormat
.Gnu"/> format writes the <c>ctime</c> field where other formats would normally read and write the <c>prefix</c> field in the header. You should only set this property to something other than <see langword="default"/> if this entry will be read by tools that know how to correctly interpret the <c>ctime</c> field of the <see cref="
TarEntryFormat
.Gnu"/> format.</para>
System\Formats\Tar\PaxGlobalExtendedAttributesTarEntry.cs (2)
16
: base(header, readerOfOrigin,
TarEntryFormat
.Pax)
26
: base(TarEntryType.GlobalExtendedAttributes, nameof(PaxGlobalExtendedAttributesTarEntry),
TarEntryFormat
.Pax, isGea: true) // Name == name of type for lack of a better temporary name until the entry is written
System\Formats\Tar\PaxTarEntry.cs (6)
17
: base(header, readerOfOrigin,
TarEntryFormat
.Pax)
38
: base(entryType, entryName,
TarEntryFormat
.Pax, isGea: false)
67
: base(entryType, entryName,
TarEntryFormat
.Pax, isGea: false)
89
: base(other,
TarEntryFormat
.Pax)
91
if (other._header._format is
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax)
System\Formats\Tar\PosixTarEntry.cs (11)
9
/// 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).
12
/// 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>
16
internal PosixTarEntry(TarHeader header, TarReader readerOfOrigin,
TarEntryFormat
format)
22
internal PosixTarEntry(TarEntryType entryType, string entryName,
TarEntryFormat
format, bool isGea)
32
internal PosixTarEntry(TarEntry other,
TarEntryFormat
format)
53
/// <exception cref="ArgumentOutOfRangeException">The value is negative, or larger than 2097151 when using <see cref="
TarEntryFormat
.V7"/> or <see cref="
TarEntryFormat
.Ustar"/>.</exception>
80
/// <exception cref="ArgumentOutOfRangeException">The value is negative, or larger than 2097151 when using <see cref="
TarEntryFormat
.V7"/> or <see cref="
TarEntryFormat
.Ustar"/>.</exception>
System\Formats\Tar\TarEntry.cs (14)
15
/// <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>
24
protected bool FormatIsOctalOnly => _header._format is
TarEntryFormat
.V7 or
TarEntryFormat
.Ustar;
27
internal TarEntry(TarHeader header, TarReader readerOfOrigin,
TarEntryFormat
format)
37
internal TarEntry(TarEntryType entryType, string entryName,
TarEntryFormat
format, bool isGea)
53
internal TarEntry(TarEntry other,
TarEntryFormat
format)
82
public
TarEntryFormat
Format => _header._format;
102
/// <exception cref="ArgumentOutOfRangeException">The specified value is larger than <see cref="DateTimeOffset.UnixEpoch"/> when using <see cref="
TarEntryFormat
.V7"/> or <see cref="
TarEntryFormat
.Ustar"/>.</exception>
120
/// <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>
265
/// <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>
System\Formats\Tar\TarEntryType.cs (10)
14
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.Ustar"/>, <see cref="
TarEntryFormat
.Pax"/> and <see cref="
TarEntryFormat
.Gnu"/> formats.</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>
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>
77
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.Gnu"/> format and is not supported for writing.</para>
82
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.V7"/> format.</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>
92
/// <para>This entry type is specific to the <see cref="
TarEntryFormat
.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>
System\Formats\Tar\TarFile.cs (23)
19
/// <inheritdoc cref="CreateFromDirectory(string, Stream, bool,
TarEntryFormat
)" />
21
=> CreateFromDirectory(sourceDirectoryName, destination, includeBaseDirectory,
TarEntryFormat
.Pax);
35
/// <exception cref="ArgumentOutOfRangeException"><paramref name="format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
37
public static void CreateFromDirectory(string sourceDirectoryName, Stream destination, bool includeBaseDirectory,
TarEntryFormat
format)
55
/// <exception cref="ArgumentOutOfRangeException"><see cref="TarWriterOptions.Format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
79
/// <inheritdoc cref="CreateFromDirectoryAsync(string, Stream, bool,
TarEntryFormat
, CancellationToken)" />
81
=> CreateFromDirectoryAsync(sourceDirectoryName, destination, includeBaseDirectory,
TarEntryFormat
.Pax, cancellationToken);
97
/// <exception cref="ArgumentOutOfRangeException"><paramref name="format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
99
public static Task CreateFromDirectoryAsync(string sourceDirectoryName, Stream destination, bool includeBaseDirectory,
TarEntryFormat
format, CancellationToken cancellationToken = default)
119
/// <exception cref="ArgumentOutOfRangeException"><see cref="TarWriterOptions.Format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
147
/// <inheritdoc cref="CreateFromDirectory(string, string, bool,
TarEntryFormat
)" />
149
=> CreateFromDirectory(sourceDirectoryName, destinationFileName, includeBaseDirectory,
TarEntryFormat
.Pax);
161
/// <exception cref="ArgumentOutOfRangeException"><paramref name="format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
163
public static void CreateFromDirectory(string sourceDirectoryName, string destinationFileName, bool includeBaseDirectory,
TarEntryFormat
format)
179
/// <exception cref="ArgumentOutOfRangeException"><see cref="TarWriterOptions.Format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
202
/// <inheritdoc cref="CreateFromDirectoryAsync(string, string, bool,
TarEntryFormat
, CancellationToken)" />
204
=> CreateFromDirectoryAsync(sourceDirectoryName, destinationFileName, includeBaseDirectory,
TarEntryFormat
.Pax, cancellationToken);
218
/// <exception cref="ArgumentOutOfRangeException"><paramref name="format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
220
public static Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationFileName, bool includeBaseDirectory,
TarEntryFormat
format, CancellationToken cancellationToken = default)
238
/// <exception cref="ArgumentOutOfRangeException"><see cref="TarWriterOptions.Format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
738
private static void ValidateFormat(
TarEntryFormat
format)
740
if (format is <
TarEntryFormat
.V7 or >
TarEntryFormat
.Gnu)
System\Formats\Tar\TarHeader.cs (14)
57
internal
TarEntryFormat
_format;
110
internal TarHeader(
TarEntryFormat
format, string name = "", int mode = 0, DateTimeOffset mTime = default, TarEntryType typeFlag = TarEntryType.RegularFile)
124
internal TarHeader(
TarEntryFormat
format, TarEntryType typeFlag, TarHeader other)
164
private static string GetMagicForFormat(
TarEntryFormat
format) => format switch
166
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax => UstarMagic,
167
TarEntryFormat
.Gnu => GnuMagic,
171
private static string GetVersionForFormat(
TarEntryFormat
format) => format switch
173
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax => UstarVersion,
174
TarEntryFormat
.Gnu => GnuVersion,
189
if (_format ==
TarEntryFormat
.Pax && _ea is not null)
206
if (_format ==
TarEntryFormat
.Pax && _ea is not null)
218
if (_format ==
TarEntryFormat
.Pax && _ea is not null)
System\Formats\Tar\TarHeader.Read.cs (24)
22
internal static async ValueTask<TarHeader?> TryGetNextHeaderCoreAsync<TAdapter>(Stream archiveStream, bool copyData,
TarEntryFormat
initialFormat, bool processDataBlock, CancellationToken cancellationToken)
46
private static TarHeader? TryReadAttributes(
TarEntryFormat
initialFormat, ReadOnlySpan<byte> buffer, Stream archiveStream)
55
if (header._format !=
TarEntryFormat
.V7)
63
Debug.Assert(header._format is
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax or
TarEntryFormat
.Gnu);
64
if (header._format is
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax)
74
else if (header._format ==
TarEntryFormat
.Gnu)
323
private static TarHeader? TryReadCommonAttributes(ReadOnlySpan<byte> buffer,
TarEntryFormat
initialFormat)
380
if (header._format ==
TarEntryFormat
.Unknown)
385
TarEntryType.GlobalExtendedAttributes =>
TarEntryFormat
.Pax,
392
TarEntryType.TapeVolume =>
TarEntryFormat
.Gnu,
395
TarEntryType.V7RegularFile =>
TarEntryFormat
.V7,
401
_ => (header._typeFlag == TarEntryType.RegularFile) ?
TarEntryFormat
.Ustar :
TarEntryFormat
.V7
435
_format =
TarEntryFormat
.V7;
443
_format =
TarEntryFormat
.Gnu;
448
if (_format ==
TarEntryFormat
.V7)
451
_format =
TarEntryFormat
.Ustar;
464
if (_format ==
TarEntryFormat
.V7)
472
case
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax:
490
case
TarEntryFormat
.Gnu:
System\Formats\Tar\TarHeader.Write.cs (39)
37
private async ValueTask WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
format, Stream archiveStream, Memory<byte> buffer, CancellationToken cancellationToken)
40
Debug.Assert(format is >
TarEntryFormat
.Unknown and <=
TarEntryFormat
.Gnu);
54
private async ValueTask WriteWithUnseekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
format, Stream destinationStream, Memory<byte> buffer, bool shouldAdvanceToEnd, CancellationToken cancellationToken)
67
TarEntryFormat
.V7 => FieldLocations.V7Data,
68
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax => FieldLocations.PosixData,
69
TarEntryFormat
.Gnu => FieldLocations.GnuData,
109
TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(
TarEntryFormat
.V7, _typeFlag);
119
TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(
TarEntryFormat
.Ustar, _typeFlag);
151
return WriteWithUnseekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.V7, archiveStream, buffer, shouldAdvanceToEnd: true, cancellationToken);
155
return WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.V7, archiveStream, buffer, cancellationToken);
165
return WriteWithUnseekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Ustar, archiveStream, buffer, shouldAdvanceToEnd: true, cancellationToken);
169
return WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Ustar, archiveStream, buffer, cancellationToken);
181
TarHeader extendedAttributesHeader = new(
TarEntryFormat
.Pax);
188
await WriteWithUnseekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Pax, tempStream, buffer, shouldAdvanceToEnd: false, cancellationToken).ConfigureAwait(false);
212
await WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Pax, archiveStream, buffer, cancellationToken).ConfigureAwait(false);
235
await longLinkHeader.WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Gnu, archiveStream, buffer, cancellationToken).ConfigureAwait(false);
244
await longPathHeader.WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Gnu, archiveStream, buffer, cancellationToken).ConfigureAwait(false);
251
await WriteWithUnseekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Gnu, archiveStream, buffer, shouldAdvanceToEnd: true, cancellationToken).ConfigureAwait(false);
255
await WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Gnu, archiveStream, buffer, cancellationToken).ConfigureAwait(false);
284
return new(
TarEntryFormat
.Gnu)
304
tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(
TarEntryFormat
.Gnu, _typeFlag));
318
return WriteWithSeekableDataStreamCoreAsync<TAdapter>(
TarEntryFormat
.Pax, archiveStream, buffer, cancellationToken);
339
tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(
TarEntryFormat
.Pax, _typeFlag));
347
private void WriteFieldsToBuffer(
TarEntryFormat
format, Span<byte> buffer)
351
case
TarEntryFormat
.V7:
354
case
TarEntryFormat
.Ustar:
357
case
TarEntryFormat
.Pax:
360
case
TarEntryFormat
.Gnu:
375
if (_format is
TarEntryFormat
.V7)
495
if (_format is not
TarEntryFormat
.Pax and not
TarEntryFormat
.Gnu)
553
if (_format is not
TarEntryFormat
.Pax)
571
if (_format is not
TarEntryFormat
.Pax)
861
if (isOctalRange || _format ==
TarEntryFormat
.Pax)
865
else if (_format ==
TarEntryFormat
.Gnu)
887
if (isOctalRange || _format ==
TarEntryFormat
.Pax)
891
else if (_format ==
TarEntryFormat
.Gnu)
System\Formats\Tar\TarHelpers.cs (10)
178
internal static TarEntryType GetRegularFileEntryTypeForFormat(
TarEntryFormat
format) => format is
TarEntryFormat
.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile;
183
internal static TarEntryType GetCorrectTypeFlagForFormat(
TarEntryFormat
format, TarEntryType entryType)
185
if (format is
TarEntryFormat
.V7)
285
internal static void ThrowIfEntryTypeNotSupported(TarEntryType entryType,
TarEntryFormat
archiveFormat, [CallerArgumentExpression(nameof(entryType))] string? paramName = null)
289
case
TarEntryFormat
.V7:
300
case
TarEntryFormat
.Ustar:
314
case
TarEntryFormat
.Pax:
332
case
TarEntryFormat
.Gnu:
357
case
TarEntryFormat
.Unknown:
System\Formats\Tar\TarReader.cs (13)
99
/// <para>More than one Global Extended Attributes Entry was found in the current <see cref="
TarEntryFormat
.Pax"/> archive.</para>
101
/// <para>Two or more Extended Attributes entries were found consecutively in the current <see cref="
TarEntryFormat
.Pax"/> archive.</para></exception>
136
/// <para>More than one Global Extended Attributes Entry was found in the current <see cref="
TarEntryFormat
.Pax"/> archive.</para>
138
/// <para>Two or more Extended Attributes entries were found consecutively in the current <see cref="
TarEntryFormat
.Pax"/> archive.</para></exception>
218
TarEntryFormat
.Pax => header._typeFlag is TarEntryType.GlobalExtendedAttributes ?
220
TarEntryFormat
.Gnu => new GnuTarEntry(header, this),
221
TarEntryFormat
.Ustar => new UstarTarEntry(header, this),
222
TarEntryFormat
.V7 or
TarEntryFormat
.Unknown or _ => new V7TarEntry(header, this),
249
TarHeader? header = await TarHeader.TryGetNextHeaderCoreAsync<TAdapter>(_archiveStream, copyData,
TarEntryFormat
.Unknown, processDataBlock: true, cancellationToken).ConfigureAwait(false);
288
TarHeader? actualHeader = await TarHeader.TryGetNextHeaderCoreAsync<TAdapter>(_archiveStream, copyData,
TarEntryFormat
.Pax, processDataBlock: false, cancellationToken).ConfigureAwait(false);
318
TarHeader? secondHeader = await TarHeader.TryGetNextHeaderCoreAsync<TAdapter>(_archiveStream, copyData,
TarEntryFormat
.Gnu, processDataBlock: true, cancellationToken).ConfigureAwait(false);
337
TarHeader? thirdHeader = await TarHeader.TryGetNextHeaderCoreAsync<TAdapter>(_archiveStream, copyData,
TarEntryFormat
.Gnu, processDataBlock: true, cancellationToken).ConfigureAwait(false);
System\Formats\Tar\TarWriter.cs (40)
28
/// <remarks>When using this constructor, <see cref="
TarEntryFormat
.Pax"/> is used as the default format of the entries written to the archive using the <see cref="WriteEntry(string, string?)"/> method.</remarks>
31
/// <remarks>The <see cref="
TarEntryFormat
.Pax"/> format is the default format as it is the most flexible and POSIX compatible. This is the only format with which <see cref="TarWriter"/> reads and stores <c>atime</c> and <c>ctime</c> when creating entries from filesystem entries.</remarks>
33
: this(archiveStream,
TarEntryFormat
.Pax, leaveOpen: false)
38
/// Initializes a <see cref="TarWriter"/> instance that can write tar entries to the specified stream and optionally leaves the stream open upon disposal of this instance. When using this constructor, the format of the resulting archive is <see cref="
TarEntryFormat
.Pax"/>.
44
/// <remarks>The <see cref="
TarEntryFormat
.Pax"/> format is the default format as it is the most flexible and POSIX compatible. This is the only format with which <see cref="TarWriter"/> reads and stores <c>atime</c> and <c>ctime</c> when creating entries from filesystem entries.</remarks>
46
: this(archiveStream,
TarEntryFormat
.Pax, leaveOpen)
55
/// <param name="format">The format to use when calling <see cref="WriteEntry(string, string?)"/>. The default value is <see cref="
TarEntryFormat
.Pax"/>.</param>
58
/// <remarks>The recommended format is <see cref="
TarEntryFormat
.Pax"/> for its flexibility.</remarks>
61
/// <exception cref="ArgumentOutOfRangeException"><paramref name="format"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
62
/// <remarks>The <see cref="
TarEntryFormat
.Pax"/> format is the default for the other <see cref="TarWriter"/> constructors. This is the recommended format as it is the most flexible and POSIX compatible. This is the only format with which <see cref="TarWriter"/> reads and stores <c>atime</c> and <c>ctime</c> when creating entries from filesystem entries.</remarks>
63
public TarWriter(Stream archiveStream,
TarEntryFormat
format =
TarEntryFormat
.Pax, bool leaveOpen = false)
68
private static TarWriterOptions CreateOptionsForFormat(
TarEntryFormat
format)
70
if (format is not
TarEntryFormat
.V7 and not
TarEntryFormat
.Ustar and not
TarEntryFormat
.Pax and not
TarEntryFormat
.Gnu)
110
public
TarEntryFormat
Format { get; }
155
/// <para>The entry will be created using the format specified in the <see cref="TarWriter(Stream,
TarEntryFormat
, bool)"/> constructor, or will use <see cref="
TarEntryFormat
.Pax"/> if other constructors are used.</para>
156
/// <para>If the format is <see cref="
TarEntryFormat
.Pax"/>, the <c>atime</c> and <c>ctime</c> from the file will be stored in the <see cref="PaxTarEntry.ExtendedAttributes"/> dictionary. If the format is <see cref="
TarEntryFormat
.Gnu"/>, this method will not set a value for <see cref="GnuTarEntry.AccessTime"/> and <see cref="GnuTarEntry.ChangeTime"/> because most TAR tools do not support these fields for this format.</para>
177
/// <para>The entry will be created using the format specified in the <see cref="TarWriter(Stream,
TarEntryFormat
, bool)"/> constructor, or will use <see cref="
TarEntryFormat
.Pax"/> if other constructors are used.</para>
178
/// <para>If the format is <see cref="
TarEntryFormat
.Pax"/>, the <c>atime</c> and <c>ctime</c> from the file will be stored in the <see cref="PaxTarEntry.ExtendedAttributes"/> dictionary. If the format is <see cref="
TarEntryFormat
.Gnu"/>, this method will not set a value for <see cref="GnuTarEntry.AccessTime"/> and <see cref="GnuTarEntry.ChangeTime"/> because most TAR tools do not support these fields for this format.</para>
214
/// <para><see cref="
TarEntryFormat
.V7"/></para>
223
/// <para><see cref="
TarEntryFormat
.Ustar"/>, <see cref="
TarEntryFormat
.Pax"/> and <see cref="
TarEntryFormat
.Gnu"/></para>
242
/// <para>To ensure an entry preserves the <c>atime</c> and <c>ctime</c> values and it is readable by other tools, it is recommended to convert the entry to <see cref="PaxTarEntry"/> instead. In that format, the two values get stored in the <see cref="PaxTarEntry.ExtendedAttributes"/>. The <see cref="
TarEntryFormat
.Pax"/> format is used as the default format by <see cref="TarWriter"/> as it is the most flexible and POSIX compatible.</para>
265
/// <para><see cref="
TarEntryFormat
.V7"/></para>
274
/// <para><see cref="
TarEntryFormat
.Ustar"/>, <see cref="
TarEntryFormat
.Pax"/> and <see cref="
TarEntryFormat
.Gnu"/></para>
316
TarEntryFormat
.V7 => entry._header.WriteAsV7CoreAsync<TAdapter>(_archiveStream, buffer, cancellationToken),
317
TarEntryFormat
.Ustar => entry._header.WriteAsUstarCoreAsync<TAdapter>(_archiveStream, buffer, cancellationToken),
318
TarEntryFormat
.Pax when entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes => entry._header.WriteAsPaxGlobalExtendedAttributesCoreAsync<TAdapter>(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++, cancellationToken),
319
TarEntryFormat
.Pax => entry._header.WriteAsPaxCoreAsync<TAdapter>(_archiveStream, buffer, cancellationToken),
320
TarEntryFormat
.Gnu => entry._header.WriteAsGnuCoreAsync<TAdapter>(_archiveStream, buffer, cancellationToken),
System\Formats\Tar\TarWriter.Unix.cs (4)
67
TarEntryFormat
.V7 => new V7TarEntry(entryType, entryName),
68
TarEntryFormat
.Ustar => new UstarTarEntry(entryType, entryName),
69
TarEntryFormat
.Pax => new PaxTarEntry(entryType, entryName),
70
TarEntryFormat
.Gnu => new GnuTarEntry(entryType, entryName),
System\Formats\Tar\TarWriterOptions.cs (8)
14
/// <value>The default value is <see cref="
TarEntryFormat
.Pax"/>.</value>
15
/// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is either <see cref="
TarEntryFormat
.Unknown"/>, or not one of the other enum values.</exception>
16
public
TarEntryFormat
Format
21
if (value is not
TarEntryFormat
.V7 and not
TarEntryFormat
.Ustar and not
TarEntryFormat
.Pax and not
TarEntryFormat
.Gnu)
27
} =
TarEntryFormat
.Pax;
System\Formats\Tar\UstarTarEntry.cs (5)
13
: base(header, readerOfOrigin,
TarEntryFormat
.Ustar)
33
: base(entryType, entryName,
TarEntryFormat
.Ustar, isGea: false)
45
: base(other,
TarEntryFormat
.Ustar)
47
if (other._header._format is
TarEntryFormat
.Ustar or
TarEntryFormat
.Pax)
System\Formats\Tar\V7TarEntry.cs (3)
13
: base(header, readerOfOrigin,
TarEntryFormat
.V7)
28
: base(entryType, entryName,
TarEntryFormat
.V7, isGea: false)
39
: base(other,
TarEntryFormat
.V7)