Class LhaArchiveEntry

Class LhaArchiveEntry

Namespace: Aspose.Zip.Lha
Assembly: Aspose.Zip.dll (25.2.0)

Represents single file within Lha archive.

public class LhaArchiveEntry : IArchiveFileEntry

Inheritance

objectLhaArchiveEntry

Implements

IArchiveFileEntry

Inherited Members

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

Properties

IsDirectory

Gets a value indicating whether this entry directory.

public bool IsDirectory { get; }

Property Value

bool

LastModified

Gets the last modified time of the entry.

[Obsolete("This property will be removed in a future release. Please use ModificationTime instead.")]
public DateTime LastModified { get; }

Property Value

DateTime

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.

Path

Gets the full path to the entry.

public string Path { get; }

Property Value

string

Methods

Extract(string)

Extracts Lha 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 lhaFile = File.Open(sourceFileName, FileMode.Open))
{
    using (var archive = new LhaArchive(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.

Extract(Stream)

Extracts the entry to the stream provided.

public void Extract(Stream destination)

Parameters

destination Stream

Destination stream. Must be writable.

Remarks

Does nothing for directory entry.

Exceptions

ArgumentException

destination does not support writing.

Extract(FileInfo)

Extracts Lha archive entry to a file.

public void Extract(FileInfo fileInfo)

Parameters

fileInfo FileInfo

FileInfo for storing decompressed data.

Examples

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

Remarks

Does nothing for directory entry.

Exceptions

InvalidOperationException

Archive headers and service information were not read.

SecurityException

The caller does not have the required permission to open the fileInfo.

ArgumentException

File path is empty or contains only white spaces.

FileNotFoundException

The file is not found.

UnauthorizedAccessException

Path to file is read-only or is a directory.

ArgumentNullException

fileInfo is null.

DirectoryNotFoundException

The specified path is invalid, such as being on an unmapped drive.

IOException

The file is already open.

 English