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
Derived
SevenZipArchiveEntryEncrypted , SevenZipArchiveEntryPlain
Implements
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
CompressionSettings
Dapatkan pengaturan untuk kompresi atau dekompresi.
public SevenZipCompressionSettings CompressionSettings { get; }
Nilai Properti
FileAttributes
Dapatkan atribut file dari sistem host.
protected FileAttributes FileAttributes { get; }
Nilai Properti
IsDirectory
Dapatkan nilai yang menunjukkan apakah entri mewakili direktori.
public bool IsDirectory { get; }
Nilai Properti
ModificationTime
Dapatkan tanggal dan waktu terakhir yang diubah.
public DateTime ModificationTime { get; }
Nilai Properti
Name
Dapatkan nama entri di dalam arkib.
public string Name { get; protected set; }
Nilai Properti
Source
Dapatkan aliran sumber data untuk masuk.
protected Stream Source { get; }
Nilai Properti
UncompressedSize
Dapatkan ukuran file asli.
public ulong UncompressedSize { get; }
Nilai Properti
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
Informasi file dari file komposisi.
Examples
using (var archive = new SevenZipArchive("archive.7z"))
{
archive.Entries[0].Extract("data.bin");
}
Exceptions
path’ is null.
Panggilan tidak memiliki izin yang diperlukan untuk mengakses.
path’ kosong, hanya mengandung ruang putih, atau mengandung karakter yang tidak sah.
Akses ke file path’ ditolak.
Contohnya, pada platform berbasis Windows, jalur harus kurang dari 248 karakter, dan nama file harus kurang dari 260 karakter.
File di path’ mengandung kolom (:) di tengah string.
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
destination’ does not support writing.
Arsip tidak dibuka untuk ekstraksi. - atau - Ini adalah direktori.
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
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
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
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) => { 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.