Class LzxArchiveEntry

Class LzxArchiveEntry

Namespace: Aspose.Zip.Lzx
Assembly: Aspose.Zip.dll (25.12.0)

Represents a single file within LZX archive.

public class LzxArchiveEntry : IArchiveFileEntry

Inheritance

object LzxArchiveEntry

Implements

IArchiveFileEntry

Inherited Members

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Properties

Commentary

Gets the commentary.

public string Commentary { get; }

Property Value

string

CompressedSize

Gets size of the compressed file.

public uint CompressedSize { get; }

Property Value

uint

IsDirectory

Gets a value indicating whether this entry is a directory.

public bool IsDirectory { get; }

Property Value

bool

Length

Gets the length of the entry in bytes.

public long? Length { get; }

Property Value

long ?

ModificationTime

Gets the last modified time of the entry.

public DateTime ModificationTime { get; }

Property Value

DateTime

Name

Gets name of the entry.

public string Name { get; }

Property Value

string

Remarks

Archives for compression only, such as gzip, bzip2, lzip, lzma, xz, z has name “File.bin” unless another name can be found in headers.

UncompressedSize

Gets size of the original file.

public uint UncompressedSize { get; }

Property Value

uint

Methods

Extract(string)

Extracts Lzx archive entry to a filesystem by path.

public FileSystemInfo Extract(string path)

Parameters

path string

Path to file which will store decompressed data.

Returns

FileSystemInfo

System.IO.FileSystemInfoInstance containing extracted data.

Examples

using (FileStream lzxFile = File.Open(sourceFileName, FileMode.Open))
{
    using (var archive = new LzxArchive(lhaFile))
    {
        archive.Entries[0].Extract("extracted.bin");
    }
}

Exceptions

InvalidOperationException

Archive headers and service information were not read.

ArgumentNullException

path is null.

SecurityException

The caller does not have the required permission to access.

ArgumentException

The path is empty, contains only white spaces, or contains invalid characters.

UnauthorizedAccessException

Access to file path is denied.

PathTooLongException

The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.

NotSupportedException

File at path contains a colon (:) in the middle of the string.

InvalidDataException

Checksum mismatch for headers or data. - or - Archive is corrupted.

OperationCanceledException

In .NET Framework 4.0 and above: Thrown when the extraction is canceled via the provided cancellation token.

NotSupportedException

Invalid compression method.

Extract(Stream)

Extracts the entry to the stream provided.

public void Extract(Stream destination)

Parameters

destination Stream

Destination stream. Must be writable.

Exceptions

ArgumentException

destination does not support writing.

InvalidDataException

Checksum mismatch for headers or data. - or - Archive is corrupted.

ArgumentNullException

Destination stream is null.

NotSupportedException

Invalid compression method.

OperationCanceledException

In .NET Framework 4.0 and above: Thrown when the extraction is canceled via the provided cancellation token.