Class SevenZipArchiveEntry

Class SevenZipArchiveEntry

Nama dari : Aspose.Zip.SevenZip Perhitungan: Aspose.Zip.dll (25.5.0)

Menampilkan satu file dalam arsip 7z.

public abstract class SevenZipArchiveEntry : IArchiveFileEntry

Inheritance

object SevenZipArchiveEntry

Derived

SevenZipArchiveEntryEncrypted , SevenZipArchiveEntryPlain

Implements

IArchiveFileEntry

anggota yang diwarisi

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

Remarks

Tuliskan Aspose.Zip.SevenZip.SevenZipArchiveEntry contoh ke Aspose.Zip.SevenZip.SevenZipArchiveEntryCrypted untuk menentukan apakah entri disulitkan atau tidak.

Properties

CompressedSize

Dapatkan ukuran file yang dikompresi.

public ulong CompressedSize { get; }

Nilai Properti

ulong

CompressionSettings

Dapatkan pengaturan untuk kompresi atau dekompresi.

public SevenZipCompressionSettings CompressionSettings { get; }

Nilai Properti

SevenZipCompressionSettings

FileAttributes

Dapatkan atribut file dari sistem host.

protected FileAttributes FileAttributes { get; }

Nilai Properti

FileAttributes

IsDirectory

Dapatkan nilai yang menunjukkan apakah entri mewakili direktori.

public bool IsDirectory { get; }

Nilai Properti

bool

ModificationTime

Dapatkan tanggal dan waktu terakhir yang diubah.

public DateTime ModificationTime { get; }

Nilai Properti

DateTime

Name

Dapatkan nama entri di dalam arkib.

public string Name { get; protected set; }

Nilai Properti

string

Source

Dapatkan aliran sumber data untuk masuk.

protected Stream Source { get; }

Nilai Properti

Stream

UncompressedSize

Dapatkan ukuran file asli.

public ulong UncompressedSize { get; }

Nilai Properti

ulong

Methods

Extract(String dan String)

Mengekstrak input ke sistem file dengan jalur yang disediakan.

public FileInfo Extract(string path, string password = null)

Parameters

path string

Jika file sudah ada, akan dituliskannya.

password string

Pilihan password untuk decryption.

Returns

FileInfo

Informasi file dari file komposisi.

Examples

using (var archive = new SevenZipArchive("archive.7z"))
{
    archive.Entries[0].Extract("data.bin");
}

Exceptions

ArgumentNullException

path’ is null.

SecurityException

Panggilan tidak memiliki izin yang diperlukan untuk mengakses.

ArgumentException

path’ kosong, hanya mengandung ruang putih, atau mengandung karakter yang tidak sah.

UnauthorizedAccessException

Akses ke file path’ ditolak.

PathTooLongException

Contohnya, pada platform berbasis Windows, jalur harus kurang dari 248 karakter, dan nama file harus kurang dari 260 karakter.

NotSupportedException

File di path’ mengandung kolom (:) di tengah string.

InvalidDataException

Arsip ini sudah rusak.

Extract(Stretch dan Stretch)

Mengekstrak input ke arus yang disediakan.

public void Extract(Stream destination, string password = null)

Parameters

destination Stream

Destination stream. harus dapat ditulis.

password string

Pilihan password untuk decryption.

Examples

Mengekstrak file zip dengan kata sandi.

using (var archive = new SevenZipArchive("archive.7z"))
{
    archive.Entries[0].Extract(httpResponseStream);
}

Exceptions

ArgumentException

destination’ does not support writing.

InvalidOperationException

Arsip tidak dibuka untuk ekstraksi. - atau - Ini adalah direktori.

InvalidDataException

Data yang salah di dalam input.

FinalizeCompressedData(Perbedaan, byte[])

Tulis ke output stream setiap headers yang mengikuti data yang dikompresi.

protected abstract int FinalizeCompressedData(Stream outputStream, byte[] encoderProperties)

Parameters

outputStream Stream

output stream untuk masuk.

encoderProperties byte [ ]

sifat dari kompresor.

Returns

int

Jumlah “teknikal” byte yang ditambahkan setelah memasukkan blok data yang signifikan.

GetDestinationStream(Stream)

Destination stream untuk masuk, dapat dihiasi.

protected abstract Stream GetDestinationStream(Stream outputStream)

Parameters

outputStream Stream

output stream untuk masuk.

Returns

Stream

Aliran destinasi untuk kompresi masuk.

Open(String)

Buka entri untuk ekstraksi dan memberikan aliran dengan konten entri.

public Stream Open(string password = null)

Parameters

password string

Pilihan password untuk decryption.

Returns

Stream

Aliran yang mewakili konten dari entri.

Examples

Penggunaan :Stream decompressed = entry.Open();

.NET 4.0 dan lebih tinggi - menggunakan metode Stream.CopyTo:decompressed.CopyTo(httpResponse.OutputStream)

.NET 3.5 dan sebelumnya - salin byte secara manual:

byte[] buffer = new byte[8192];
int bytesRead;
while (0 < (bytesRead = decompressed.Read(buffer, 0, buffer.Length)))
 fileStream.Write(buffer, 0, bytesRead);
```</p>

#### Remarks

Read from the stream to get the original content of a file. See examples section.

#### Exceptions

 [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception)

The archive is not opened for extraction. - or - This entry is a directory.

 [InvalidDataException](https://learn.microsoft.com/dotnet/api/system.io.invaliddataexception)

Wrong data within the entry.

### <a id="Aspose_Zip_SevenZip_SevenZipArchiveEntry_CompressionProgressed"></a> CompressionProgressed

Raises when a portion of raw stream compressed.

```csharp
public event EventHandler<progresseventargs> CompressionProgressed

Jenis Peristiwa

EventHandler dan lt; ProgressEventArgs >

Examples

archive.Entries[0].CompressionProgressed += (s, e) =&gt; { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };

Remarks

Pengirim acara adalah instansi Aspose.Zip.SevenZip.SevenZipArchiveEntry.

Tidak memanggil dalam mode multithread untuk entri LZMA2.

 Indonesia