RarArchiveEntry Class

An entry of a RAR archive: a file, a directory, or a link. An entry whose data are split between volumes is one entry. The entries of RarArchive and of the forward-only reader of RAR archives are of this type.

public sealed class RarArchiveEntry : ArchiveEntry
Inheritance
ArchiveEntry RarArchiveEntry

Properties

NameDescription
ArchiveGets the archive of the entry, or null for an entry of the forward-only reader (its content can be read only while it is the current entry of the reader).
AttributesGets the Windows attributes of the entry, for an entry created on Windows, MS-DOS or OS/2.
Blake2spHashGets the BLAKE2sp hash (32 bytes) of the content of the entry, or an empty value when the archive does not store it, when it stores a hash that depends on the encryption key, or when the header of the last part of an entry split between volumes is not read yet (in the forward-only reader).
CompressedLengthGets the length of the compressed data of the entry, in all its volumes. In the forward-only reader, the length of the parts of an entry split between volumes is known once its content is read.
CompressionMethodGets the compression method: 0 for stored data, 1 (fastest) to 5 (best) for compressed data.
CompressionVersionGets the version of the compression algorithm: 15, 20, 26, 29 or 36 for the archives of RAR 1.5-4.x (RAR 1.5, 2.0, 2.6, 2.9), 50 for the RAR 5.0 algorithm and 70 for the RAR 7.0 algorithm.
Crc32Gets the CRC-32 of the content of the entry, or null when the archive does not store it (a RAR5 archive may store a BLAKE2sp hash instead), when it stores a CRC that depends on the encryption key, or when the header of the last part of an entry split between volumes is not read yet (in the forward-only reader).
CreationTimeGets the time the entry was created, or null when the archive does not store it.
DictionarySizeGets the size of the dictionary of the compression, or 0 for a directory.
FullNameGets the path of the entry in the archive, with / separators. A version of a file archived with the -ver switch of RAR has the suffix ;N where N is its version number, as in the listing of unrar.
HardLinkTargetGets the path of the entry whose content this entry shares: the target of a hard link or of a file copy of RAR5, or null. RarArchiveEntry.Open returns the content of the target in a RarArchive, and an empty stream in the forward-only reader.
HostAttributesGets the raw attributes of the entry: Windows attributes or a Unix mode, depending on RarArchiveEntry.HostOperatingSystem.
HostOperatingSystemGets the operating system that created the entry, which defines the meaning of its attributes.
IsDirectoryGets a value indicating whether the entry is a directory.
IsEncryptedGets a value indicating whether the content of the entry is encrypted.
IsSolidGets a value indicating whether the entry continues the compression dictionary of the previous entry (a solid archive).
LastAccessTimeGets the last time the entry was accessed, or null when the archive does not store it.
LastWriteTimeGets the last time the entry was modified, or null when the archive does not store it.
LengthGets the length of the content of the entry: 0 for a directory, -1 when the archive does not store it. For a link of RAR5, it is the length the archive records (the length of the target), while RarArchiveEntry.Open returns an empty stream for a symbolic link.
LinkTargetGets the target of a symbolic link (a Unix or Windows symbolic link, or a Windows junction of RAR5, a Unix symbolic link of RAR 1.5-4.x), or null. The separators are /; the target of a junction is absolute. For a link of RAR 1.5-4.x, the target is the content of the entry, read on the first access.
UnixFileModeGets the Unix permissions of the entry, for an entry created on Unix.

Gets the archive of the entry, or null for an entry of the forward-only reader (its content can be read only while it is the current entry of the reader).

public RarArchive? Archive { get; }

Property value

RarArchive?

Gets the Windows attributes of the entry, for an entry created on Windows, MS-DOS or OS/2.

public override FileAttributes? Attributes { get; }

Property value

FileAttributes?

Blake2spHash

RarArchiveEntry.cs

Gets the BLAKE2sp hash (32 bytes) of the content of the entry, or an empty value when the archive does not store it, when it stores a hash that depends on the encryption key, or when the header of the last part of an entry split between volumes is not read yet (in the forward-only reader).

public ReadOnlyMemory<byte> Blake2spHash { get; }

Property value

ReadOnlyMemory<byte>

CompressedLength

RarArchiveEntry.cs

Gets the length of the compressed data of the entry, in all its volumes. In the forward-only reader, the length of the parts of an entry split between volumes is known once its content is read.

public override long CompressedLength { get; }

Property value

long

CompressionMethod

RarArchiveEntry.cs

Gets the compression method: 0 for stored data, 1 (fastest) to 5 (best) for compressed data.

public int CompressionMethod { get; }

Property value

int

CompressionVersion

RarArchiveEntry.cs

Gets the version of the compression algorithm: 15, 20, 26, 29 or 36 for the archives of RAR 1.5-4.x (RAR 1.5, 2.0, 2.6, 2.9), 50 for the RAR 5.0 algorithm and 70 for the RAR 7.0 algorithm.

public int CompressionVersion { get; }

Property value

int

Gets the CRC-32 of the content of the entry, or null when the archive does not store it (a RAR5 archive may store a BLAKE2sp hash instead), when it stores a CRC that depends on the encryption key, or when the header of the last part of an entry split between volumes is not read yet (in the forward-only reader).

public override uint? Crc32 { get; }

Property value

uint?

CreationTime

RarArchiveEntry.cs

Gets the time the entry was created, or null when the archive does not store it.

public override DateTimeOffset? CreationTime { get; }

Property value

DateTimeOffset?

DictionarySize

RarArchiveEntry.cs

Gets the size of the dictionary of the compression, or 0 for a directory.

public long DictionarySize { get; }

Property value

long

Gets the path of the entry in the archive, with / separators. A version of a file archived with the -ver switch of RAR has the suffix ;N where N is its version number, as in the listing of unrar.

public override string FullName { get; }

Property value

string

HardLinkTarget

RarArchiveEntry.cs

Gets the path of the entry whose content this entry shares: the target of a hard link or of a file copy of RAR5, or null. RarArchiveEntry.Open returns the content of the target in a RarArchive, and an empty stream in the forward-only reader.

public override string? HardLinkTarget { get; }

Property value

string?

HostAttributes

RarArchiveEntry.cs

Gets the raw attributes of the entry: Windows attributes or a Unix mode, depending on RarArchiveEntry.HostOperatingSystem.

public uint HostAttributes { get; }

Property value

uint

HostOperatingSystem

RarArchiveEntry.cs

Gets the operating system that created the entry, which defines the meaning of its attributes.

public RarHostOperatingSystem HostOperatingSystem { get; }

Gets a value indicating whether the entry is a directory.

public override bool IsDirectory { get; }

Property value

bool

Gets a value indicating whether the content of the entry is encrypted.

public override bool IsEncrypted { get; }

Property value

bool

Gets a value indicating whether the entry continues the compression dictionary of the previous entry (a solid archive).

public bool IsSolid { get; }

Property value

bool

LastAccessTime

RarArchiveEntry.cs

Gets the last time the entry was accessed, or null when the archive does not store it.

public override DateTimeOffset? LastAccessTime { get; }

Property value

DateTimeOffset?

LastWriteTime

RarArchiveEntry.cs

Gets the last time the entry was modified, or null when the archive does not store it.

public override DateTimeOffset? LastWriteTime { get; }

Property value

DateTimeOffset?

Gets the length of the content of the entry: 0 for a directory, -1 when the archive does not store it. For a link of RAR5, it is the length the archive records (the length of the target), while RarArchiveEntry.Open returns an empty stream for a symbolic link.

public override long Length { get; }

Property value

long

Gets the target of a symbolic link (a Unix or Windows symbolic link, or a Windows junction of RAR5, a Unix symbolic link of RAR 1.5-4.x), or null. The separators are /; the target of a junction is absolute. For a link of RAR 1.5-4.x, the target is the content of the entry, read on the first access.

public override string? LinkTarget { get; }

Property value

string?

UnixFileMode

RarArchiveEntry.cs

Gets the Unix permissions of the entry, for an entry created on Unix.

public override UnixFileMode? UnixFileMode { get; }

Property value

UnixFileMode?

Methods

NameDescription
Open()Opens the content of the entry. The stream checks the CRC or the hash the archive stores, and throws an InvalidDataException at its end when they do not match.

Opens the content of the entry. The stream checks the CRC or the hash the archive stores, and throws an InvalidDataException at its end when they do not match.

public override Stream Open()

Returns

Stream A read-only stream of the content of the entry.

Exceptions

InvalidDataException
The archive is corrupted.
ArchivePasswordException
The entry is encrypted and the password is missing or wrong.
NotSupportedException
The entry is compressed or encrypted with a method that is not supported.