78 references to TarHelpers
System.Formats.Tar (78)
System\Formats\Tar\PaxTarEntry.cs (2)
101_header.ExtendedAttributes[TarHeader.PaxEaATime] = TarHelpers.GetTimestampStringFromDateTimeOffset(gnuOther.AccessTime); 105_header.ExtendedAttributes[TarHeader.PaxEaCTime] = TarHelpers.GetTimestampStringFromDateTimeOffset(gnuOther.ChangeTime);
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 (34)
24Span<byte> buffer = stackalloc byte[TarHelpers.RecordSize]; 45byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 46Memory<byte> buffer = rented.AsMemory(0, TarHelpers.RecordSize); // minimumLength means the array could've been larger 124if (TarHelpers.TryGetDateTimeOffsetFromTimestampString(ExtendedAttributes, PaxEaMTime, out DateTimeOffset mTime)) 130if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaMode, out int mode)) 136if (TarHelpers.TryGetStringAsBaseTenLong(ExtendedAttributes, PaxEaSize, out long size)) 142if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaUid, out int uid)) 148if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaGid, out int gid)) 166if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMajor, out int devMajor)) 172if (TarHelpers.TryGetStringAsBaseTenInteger(ExtendedAttributes, PaxEaDevMinor, out int devMinor)) 219TarHelpers.AdvanceStream(archiveStream, _size); 235TarHelpers.SkipBlockAlignmentPadding(archiveStream, _size); 281await TarHelpers.AdvanceStreamAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false); 297await TarHelpers.SkipBlockAlignmentPaddingAsync(archiveStream, _size, cancellationToken).ConfigureAwait(false); 321TarHelpers.CopyBytes(archiveStream, copiedData, _size); 348await TarHelpers.CopyBytesAsync(archiveStream, copiedData, size, cancellationToken).ConfigureAwait(false); 368if (TarHelpers.IsAllNullBytes(spanChecksum)) 372int checksum = (int)TarHelpers.ParseOctal<uint>(spanChecksum); 379long size = TarHelpers.ParseNumeric<long>(buffer.Slice(FieldLocations.Size, FieldLengths.Size)); 387name: TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.Name, FieldLengths.Name)), 388mode: TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Mode, FieldLengths.Mode)), 394_uid = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Uid, FieldLengths.Uid)), 395_gid = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.Gid, FieldLengths.Gid)), 396_linkName = TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.LinkName, FieldLengths.LinkName)) 434if (TarHelpers.IsAllNullBytes(magic)) 520_uName = TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.UName, FieldLengths.UName)); 521_gName = TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.GName, FieldLengths.GName)); 528_devMajor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMajor, FieldLengths.DevMajor)); 531_devMinor = TarHelpers.ParseNumeric<int>(buffer.Slice(FieldLocations.DevMinor, FieldLengths.DevMinor)); 555long time = TarHelpers.ParseNumeric<long>(buffer); 556return TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(time); 563_prefix = TarHelpers.GetTrimmedUtf8String(buffer.Slice(FieldLocations.Prefix, FieldLengths.Prefix)); 634buffer = TarHelpers.TrimEndingNullsAndSpaces(buffer); 694string longPath = TarHelpers.GetTrimmedUtf8String(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 (4)
231TarHelpers.AdvanceStream(_archiveStream, bytesToSkip); 235TarHelpers.SkipBlockAlignmentPadding(_archiveStream, _previouslyReadEntry._header._size); 273await TarHelpers.AdvanceStreamAsync(_archiveStream, bytesToSkip, cancellationToken).ConfigureAwait(false); 277await 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;