208 references to TarEntryFormat
System.Formats.Tar (208)
System\Formats\Tar\GnuTarEntry.cs (4)
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> 14: base(header, readerOfOrigin, TarEntryFormat.Gnu) 34: base(entryType, entryName, TarEntryFormat.Gnu, isGea: false) 47: base(other, TarEntryFormat.Gnu)
System\Formats\Tar\PaxGlobalExtendedAttributesTarEntry.cs (2)
18: base(header, readerOfOrigin, TarEntryFormat.Pax) 28: 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)
19: base(header, readerOfOrigin, TarEntryFormat.Pax) 53: base(entryType, entryName, TarEntryFormat.Pax, isGea: false) 92: base(entryType, entryName, TarEntryFormat.Pax, isGea: false) 110: base(other, TarEntryFormat.Pax) 112if (other._header._format is TarEntryFormat.Ustar or TarEntryFormat.Pax)
System\Formats\Tar\PosixTarEntry.cs (7)
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> 16internal PosixTarEntry(TarHeader header, TarReader readerOfOrigin, TarEntryFormat format) 22internal PosixTarEntry(TarEntryType entryType, string entryName, TarEntryFormat format, bool isGea) 32internal PosixTarEntry(TarEntry other, TarEntryFormat format)
System\Formats\Tar\TarEntry.cs (10)
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> 24internal TarEntry(TarHeader header, TarReader readerOfOrigin, TarEntryFormat format) 34internal TarEntry(TarEntryType entryType, string entryName, TarEntryFormat format, bool isGea) 50internal TarEntry(TarEntry other, TarEntryFormat format) 79public TarEntryFormat Format => _header._format; 109/// <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> 244/// <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 (2)
330using (TarWriter writer = new TarWriter(destination, TarEntryFormat.Pax, leaveOpen)) 384TarWriter writer = new TarWriter(destination, TarEntryFormat.Pax, leaveOpen);
System\Formats\Tar\TarHeader.cs (11)
47internal TarEntryFormat _format; 89internal TarHeader(TarEntryFormat format, string name = "", int mode = 0, DateTimeOffset mTime = default, TarEntryType typeFlag = TarEntryType.RegularFile) 102internal TarHeader(TarEntryFormat format, TarEntryType typeFlag, TarHeader other) 139private static string GetMagicForFormat(TarEntryFormat format) => format switch 141TarEntryFormat.Ustar or TarEntryFormat.Pax => UstarMagic, 142TarEntryFormat.Gnu => GnuMagic, 146private static string GetVersionForFormat(TarEntryFormat format) => format switch 148TarEntryFormat.Ustar or TarEntryFormat.Pax => UstarVersion, 149TarEntryFormat.Gnu => GnuVersion,
System\Formats\Tar\TarHeader.Read.cs (24)
21internal static TarHeader? TryGetNextHeader(Stream archiveStream, bool copyData, TarEntryFormat initialFormat, bool processDataBlock) 40internal static async ValueTask<TarHeader?> TryGetNextHeaderAsync(Stream archiveStream, bool copyData, TarEntryFormat initialFormat, bool processDataBlock, CancellationToken cancellationToken) 61private static TarHeader? TryReadAttributes(TarEntryFormat initialFormat, Span<byte> buffer) 70if (header._format != TarEntryFormat.V7) 78Debug.Assert(header._format is TarEntryFormat.Ustar or TarEntryFormat.Pax or TarEntryFormat.Gnu); 79if (header._format == TarEntryFormat.Ustar) 83else if (header._format == TarEntryFormat.Gnu) 360private static TarHeader? TryReadCommonAttributes(Span<byte> buffer, TarEntryFormat initialFormat) 398if (header._format == TarEntryFormat.Unknown) 403TarEntryType.GlobalExtendedAttributes => TarEntryFormat.Pax, 410TarEntryType.TapeVolume => TarEntryFormat.Gnu, 413TarEntryType.V7RegularFile => TarEntryFormat.V7, 419_ => (header._typeFlag == TarEntryType.RegularFile) ? TarEntryFormat.Ustar : TarEntryFormat.V7 435_format = TarEntryFormat.V7; 443_format = TarEntryFormat.Gnu; 448if (_format == TarEntryFormat.V7) 451_format = TarEntryFormat.Ustar; 464if (_format == TarEntryFormat.V7) 472case TarEntryFormat.Ustar or TarEntryFormat.Pax: 490case TarEntryFormat.Gnu:
System\Formats\Tar\TarHeader.Write.cs (56)
29private void WriteWithSeekableDataStream(TarEntryFormat format, Stream archiveStream, Span<byte> buffer) 31Debug.Assert(format is > TarEntryFormat.Unknown and <= TarEntryFormat.Gnu); 45private async Task WriteWithSeekableDataStreamAsync(TarEntryFormat format, Stream archiveStream, Memory<byte> buffer, CancellationToken cancellationToken) 47Debug.Assert(format is > TarEntryFormat.Unknown and <= TarEntryFormat.Gnu); 61private void WriteWithUnseekableDataStream(TarEntryFormat format, Stream destinationStream, Span<byte> buffer, bool shouldAdvanceToEnd) 73TarEntryFormat.V7 => FieldLocations.V7Data, 74TarEntryFormat.Ustar or TarEntryFormat.Pax => FieldLocations.PosixData, 75TarEntryFormat.Gnu => FieldLocations.GnuData, 110private async Task WriteWithUnseekableDataStreamAsync(TarEntryFormat format, Stream destinationStream, Memory<byte> buffer, bool shouldAdvanceToEnd, CancellationToken cancellationToken) 122TarEntryFormat.V7 => FieldLocations.V7Data, 123TarEntryFormat.Ustar or TarEntryFormat.Pax => FieldLocations.PosixData, 124TarEntryFormat.Gnu => FieldLocations.GnuData, 161TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.V7, _typeFlag); 171TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Ustar, _typeFlag); 213WriteWithUnseekableDataStream(TarEntryFormat.V7, archiveStream, buffer, shouldAdvanceToEnd: true); 217WriteWithSeekableDataStream(TarEntryFormat.V7, archiveStream, buffer); 227return WriteWithUnseekableDataStreamAsync(TarEntryFormat.V7, archiveStream, buffer, shouldAdvanceToEnd: true, cancellationToken); 231return WriteWithSeekableDataStreamAsync(TarEntryFormat.V7, archiveStream, buffer, cancellationToken); 240WriteWithUnseekableDataStream(TarEntryFormat.Ustar, archiveStream, buffer, shouldAdvanceToEnd: true); 244WriteWithSeekableDataStream(TarEntryFormat.Ustar, archiveStream, buffer); 254return WriteWithUnseekableDataStreamAsync(TarEntryFormat.Ustar, archiveStream, buffer, shouldAdvanceToEnd: true, cancellationToken); 258return WriteWithSeekableDataStreamAsync(TarEntryFormat.Ustar, archiveStream, buffer, cancellationToken); 269TarHeader extendedAttributesHeader = new(TarEntryFormat.Pax); 276WriteWithUnseekableDataStream(TarEntryFormat.Pax, tempStream, buffer, shouldAdvanceToEnd: false); 300WriteWithSeekableDataStream(TarEntryFormat.Pax, archiveStream, buffer); 313TarHeader extendedAttributesHeader = new(TarEntryFormat.Pax); 320await WriteWithUnseekableDataStreamAsync(TarEntryFormat.Pax, tempStream, buffer, shouldAdvanceToEnd: false, cancellationToken).ConfigureAwait(false); 344await WriteWithSeekableDataStreamAsync(TarEntryFormat.Pax, archiveStream, buffer, cancellationToken).ConfigureAwait(false); 359longLinkHeader.WriteWithSeekableDataStream(TarEntryFormat.Gnu, archiveStream, buffer); 368longPathHeader.WriteWithSeekableDataStream(TarEntryFormat.Gnu, archiveStream, buffer); 375WriteWithUnseekableDataStream(TarEntryFormat.Gnu, archiveStream, buffer, shouldAdvanceToEnd: true); 379WriteWithSeekableDataStream(TarEntryFormat.Gnu, archiveStream, buffer); 395await longLinkHeader.WriteWithSeekableDataStreamAsync(TarEntryFormat.Gnu, archiveStream, buffer, cancellationToken).ConfigureAwait(false); 404await longPathHeader.WriteWithSeekableDataStreamAsync(TarEntryFormat.Gnu, archiveStream, buffer, cancellationToken).ConfigureAwait(false); 411await WriteWithUnseekableDataStreamAsync(TarEntryFormat.Gnu, archiveStream, buffer, shouldAdvanceToEnd: true, cancellationToken).ConfigureAwait(false); 415await WriteWithSeekableDataStreamAsync(TarEntryFormat.Gnu, archiveStream, buffer, cancellationToken).ConfigureAwait(false); 424return new(TarEntryFormat.Gnu) 440tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Gnu, _typeFlag)); 453WriteWithSeekableDataStream(TarEntryFormat.Pax, archiveStream, buffer); 462return WriteWithSeekableDataStreamAsync(TarEntryFormat.Pax, archiveStream, buffer, cancellationToken); 483tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Pax, _typeFlag)); 491private void WriteFieldsToBuffer(TarEntryFormat format, Span<byte> buffer) 495case TarEntryFormat.V7: 498case TarEntryFormat.Ustar: 501case TarEntryFormat.Pax: 504case TarEntryFormat.Gnu: 519if (_format is TarEntryFormat.V7) 628else if (_format is not TarEntryFormat.Pax) 652if (_format is not TarEntryFormat.Pax and not TarEntryFormat.Gnu) 710if (_format is not TarEntryFormat.Pax) 728if (_format is not TarEntryFormat.Pax)
System\Formats\Tar\TarHelpers.cs (8)
201internal static TarEntryType GetCorrectTypeFlagForFormat(TarEntryFormat format, TarEntryType entryType) 203if (format is TarEntryFormat.V7) 310internal static void ThrowIfEntryTypeNotSupported(TarEntryType entryType, TarEntryFormat archiveFormat, [CallerArgumentExpression(nameof(entryType))] string? paramName = null) 314case TarEntryFormat.V7: 325case TarEntryFormat.Ustar: 339case TarEntryFormat.Pax: 357case TarEntryFormat.Gnu: 382case TarEntryFormat.Unknown:
System\Formats\Tar\TarReader.cs (23)
111/// <para>More than one Global Extended Attributes Entry was found in the current <see cref="TarEntryFormat.Pax"/> archive.</para> 113/// <para>Two or more Extended Attributes entries were found consecutively in the current <see cref="TarEntryFormat.Pax"/> archive.</para></exception> 138TarEntryFormat.Pax => header._typeFlag is TarEntryType.GlobalExtendedAttributes ? 140TarEntryFormat.Gnu => new GnuTarEntry(header, this), 141TarEntryFormat.Ustar => new UstarTarEntry(header, this), 142TarEntryFormat.V7 or TarEntryFormat.Unknown or _ => new V7TarEntry(header, this), 171/// <para>More than one Global Extended Attributes Entry was found in the current <see cref="TarEntryFormat.Pax"/> archive.</para> 173/// <para>Two or more Extended Attributes entries were found consecutively in the current <see cref="TarEntryFormat.Pax"/> archive.</para></exception> 291TarEntryFormat.Pax => header._typeFlag is TarEntryType.GlobalExtendedAttributes ? 293TarEntryFormat.Gnu => new GnuTarEntry(header, this), 294TarEntryFormat.Ustar => new UstarTarEntry(header, this), 295TarEntryFormat.V7 or TarEntryFormat.Unknown or _ => new V7TarEntry(header, this), 321TarHeader? header = TarHeader.TryGetNextHeader(_archiveStream, copyData, TarEntryFormat.Unknown, processDataBlock: true); 363TarHeader? header = await TarHeader.TryGetNextHeaderAsync(_archiveStream, copyData, TarEntryFormat.Unknown, processDataBlock: true, cancellationToken).ConfigureAwait(false); 401actualHeader = TarHeader.TryGetNextHeader(_archiveStream, copyData, TarEntryFormat.Pax, processDataBlock: false); 434TarHeader? actualHeader = await TarHeader.TryGetNextHeaderAsync(_archiveStream, copyData, TarEntryFormat.Pax, processDataBlock: false, cancellationToken).ConfigureAwait(false); 468finalHeader = new(TarEntryFormat.Gnu); 470TarHeader? secondHeader = TarHeader.TryGetNextHeader(_archiveStream, copyData, TarEntryFormat.Gnu, processDataBlock: true); 488TarHeader? thirdHeader = TarHeader.TryGetNextHeader(_archiveStream, copyData, TarEntryFormat.Gnu, processDataBlock: true); 547TarHeader? secondHeader = await TarHeader.TryGetNextHeaderAsync(_archiveStream, copyData, TarEntryFormat.Gnu, processDataBlock: true, cancellationToken).ConfigureAwait(false); 566TarHeader? thirdHeader = await TarHeader.TryGetNextHeaderAsync(_archiveStream, copyData, TarEntryFormat.Gnu, processDataBlock: true, cancellationToken).ConfigureAwait(false);
System\Formats\Tar\TarWriter.cs (32)
27/// <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: this(archiveStream, TarEntryFormat.Pax, leaveOpen: false) 36/// 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"/>. 43: this(archiveStream, TarEntryFormat.Pax, leaveOpen) 52/// <param name="format">The format to use when calling <see cref="WriteEntry(string, string?)"/>. The default value is <see cref="TarEntryFormat.Pax"/>.</param> 55/// <remarks>The recommended format is <see cref="TarEntryFormat.Pax"/> for its flexibility.</remarks> 58/// <exception cref="ArgumentOutOfRangeException"><paramref name="format"/> is either <see cref="TarEntryFormat.Unknown"/>, or not one of the other enum values.</exception> 59public TarWriter(Stream archiveStream, TarEntryFormat format = TarEntryFormat.Pax, bool leaveOpen = false) 68if (format is not TarEntryFormat.V7 and not TarEntryFormat.Ustar and not TarEntryFormat.Pax and not TarEntryFormat.Gnu) 84public TarEntryFormat Format { get; } 194/// <para><see cref="TarEntryFormat.V7"/></para> 203/// <para><see cref="TarEntryFormat.Ustar"/>, <see cref="TarEntryFormat.Pax"/> and <see cref="TarEntryFormat.Gnu"/></para> 238/// <para><see cref="TarEntryFormat.V7"/></para> 247/// <para><see cref="TarEntryFormat.Ustar"/>, <see cref="TarEntryFormat.Pax"/> and <see cref="TarEntryFormat.Gnu"/></para> 286case TarEntryFormat.V7: 290case TarEntryFormat.Ustar: 294case TarEntryFormat.Pax: 305case TarEntryFormat.Gnu: 310Debug.Assert(entry.Format == TarEntryFormat.Unknown, "Missing format handler"); 328TarEntryFormat.V7 => entry._header.WriteAsV7Async(_archiveStream, buffer, cancellationToken), 329TarEntryFormat.Ustar => entry._header.WriteAsUstarAsync(_archiveStream, buffer, cancellationToken), 330TarEntryFormat.Pax when entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes => entry._header.WriteAsPaxGlobalExtendedAttributesAsync(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++, cancellationToken), 331TarEntryFormat.Pax => entry._header.WriteAsPaxAsync(_archiveStream, buffer, cancellationToken), 332TarEntryFormat.Gnu => entry._header.WriteAsGnuAsync(_archiveStream, buffer, cancellationToken),
System\Formats\Tar\TarWriter.Unix.cs (5)
36Interop.Sys.FileTypes.S_IFREG => Format is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, 45TarEntryFormat.V7 => new V7TarEntry(entryType, entryName), 46TarEntryFormat.Ustar => new UstarTarEntry(entryType, entryName), 47TarEntryFormat.Pax => new PaxTarEntry(entryType, entryName), 48TarEntryFormat.Gnu => new GnuTarEntry(entryType, entryName),
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) 47if (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)