77 references to TarHelpers
System.Formats.Tar (77)
System\Formats\Tar\PaxTarEntry.cs (2)
99_header.ExtendedAttributes[TarHeader.PaxEaATime] = TarHelpers.GetTimestampStringFromDateTimeOffset(gnuOther.AccessTime); 103_header.ExtendedAttributes[TarHeader.PaxEaCTime] = TarHelpers.GetTimestampStringFromDateTimeOffset(gnuOther.ChangeTime);
System\Formats\Tar\SubReadStream.cs (2)
77return TarHelpers.AdvanceStreamAsync(_superStream, remaining, cancellationToken); 86TarHelpers.AdvanceStream(_superStream, remaining);
System\Formats\Tar\TarEntry.cs (12)
45TarHelpers.ThrowIfEntryTypeNotSupported(entryType, format); 49_header = new TarHeader(format, entryName, TarHelpers.GetDefaultMode(entryType), DateTimeOffset.UtcNow, entryType); 60TarEntryType compatibleEntryType = TarHelpers.GetCorrectTypeFlagForFormat(format, other.EntryType); 62TarHelpers.ThrowIfEntryTypeNotSupported(compatibleEntryType, format, nameof(other)); 146get => (UnixFileMode)(_header._mode & (int)TarHelpers.ValidUnixFileModes); 149if ((value & ~TarHelpers.ValidUnixFileModes) != 0) // throw on invalid UnixFileModes 309TarHelpers.CreateDirectory(destinationFullPath, Mode, pendingModes); 310TarHelpers.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime); 315TarHelpers.CreateDirectory(Path.GetDirectoryName(destinationFullPath)!, mode: null, pendingModes); 332TarHelpers.CreateDirectory(destinationFullPath, Mode, pendingModes); 333TarHelpers.UpdatePendingModificationTimes(directoryModificationTimes, destinationFullPath, ModificationTime); 339TarHelpers.CreateDirectory(Path.GetDirectoryName(destinationFullPath)!, mode: null, pendingModes);
System\Formats\Tar\TarFile.cs (6)
460SortedDictionary<string, UnixFileMode>? pendingModes = TarHelpers.CreatePendingModesDictionary(); 470TarHelpers.SetPendingModes(pendingModes); 471TarHelpers.SetPendingModificationTimes(directoryModificationTimes); 502SortedDictionary<string, UnixFileMode>? pendingModes = TarHelpers.CreatePendingModesDictionary(); 516TarHelpers.SetPendingModes(pendingModes); 517TarHelpers.SetPendingModificationTimes(directoryModificationTimes);
System\Formats\Tar\TarHeader.Read.cs (33)
25Span<byte> buffer = stackalloc byte[TarHelpers.RecordSize]; 46byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 47Memory<byte> buffer = rented.AsMemory(0, TarHelpers.RecordSize); // minimumLength means the array could've been larger 125if (TarHelpers.TryGetDateTimeOffsetFromTimestampString(ExtendedAttributes, PaxEaMTime, out DateTimeOffset mTime)) 131if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaMode, out int mode)) 137if (TarHelpers.TryGetStringAsBaseTenLong(ExtendedAttributes, PaxEaSize, out long size)) 143if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaUid, out int uid)) 149if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaGid, out int gid)) 167if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMajor, out int devMajor)) 173if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMinor, out int devMinor)) 220TarHelpers.AdvanceStream(archiveStream, _size); 236TarHelpers.SkipBlockAlignmentPadding(archiveStream, _size); 282await TarHelpers.AdvanceStreamAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false); 298await TarHelpers.SkipBlockAlignmentPaddingAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false); 322TarHelpers.CopyBytes(archiveStream, copiedData, _size); 349await TarHelpers.CopyBytesAsync(archiveStream, copiedData, size, cancellationToken).ConfigureAwait(false); 369if (TarHelpers.IsAllNullBytes(spanChecksum)) 373int checksum = (int)TarHelpers.ParseOctal<uint>(spanChecksum); 380long size = TarHelpers.ParseNumeric<long>(buffer.Slice(FieldLocations.Size, FieldLengths.Size)); 388name: TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.Name, FieldLengths.Name)), 389mode: TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)), 395_uid = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)), 396_gid = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)), 397_linkName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName)) 435if (TarHelpers.IsAllNullBytes(magic)) 521_uName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.UName, FieldLengths.UName)); 522_gName = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.GName, FieldLengths.GName)); 529_devMajor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor)); 532_devMinor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor)); 556long time = TarHelpers.ParseNumeric<long>(buffer); 557return TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(time); 564_prefix = TarHelpers.ParseUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix)); 698string longPath = TarHelpers.ParseUtf8String(buffer);
System\Formats\Tar\TarHeader.Write.cs (13)
174TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.V7, _typeFlag); 184TarEntryType actualEntryType = TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Ustar, _typeFlag); 469_mode = TarHelpers.GetDefaultMode(entryType), 486tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Gnu, _typeFlag)); 521_mode = TarHelpers.GetDefaultMode(_typeFlag); 529tmpChecksum += WriteCommonFields(buffer, TarHelpers.GetCorrectTypeFlagForFormat(TarEntryFormat.Pax, _typeFlag)); 813int paddingAfterData = TarHelpers.CalculatePadding(_size); 816Debug.Assert(paddingAfterData <= TarHelpers.RecordSize); 818Span<byte> zeros = stackalloc byte[TarHelpers.RecordSize]; 829int paddingAfterData = TarHelpers.CalculatePadding(_size); 832Debug.Assert(paddingAfterData <= TarHelpers.RecordSize); 851int paddingAfterData = TarHelpers.CalculatePadding(_size); 947ExtendedAttributes[PaxEaMTime] = TarHelpers.GetTimestampStringFromDateTimeOffset(_mTime);
System\Formats\Tar\TarReader.cs (2)
226TarHelpers.SkipBlockAlignmentPadding(_archiveStream, _previouslyReadEntry._header._size); 259await TarHelpers.SkipBlockAlignmentPaddingAsync(_archiveStream, _previouslyReadEntry._header._size, cancellationToken).ConfigureAwait(false);
System\Formats\Tar\TarWriter.cs (5)
296Span<byte> buffer = stackalloc byte[TarHelpers.RecordSize]; 337byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 338Memory<byte> buffer = rented.AsMemory(0, TarHelpers.RecordSize); // minimumLength means the array could've been larger 361Span<byte> emptyRecord = stackalloc byte[TarHelpers.RecordSize]; 373const int TwoRecordSize = TarHelpers.RecordSize * 2;
System\Formats\Tar\TarWriter.Unix.cs (2)
65entry._header._mTime = TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(status.MTime); 73entry._header._mode = status.Mode & (int)TarHelpers.ValidUnixFileModes;