Class CabEntry

Class CabEntry

Tên không gian: Aspose.Zip.Cab Tổng hợp: Aspose.Zip.dll (25.5.0)

Nó đại diện cho một tập tin duy nhất trong hồ sơ cab.

public sealed class CabEntry : IArchiveFileEntry

Inheritance

object CabEntry

Implements

IArchiveFileEntry

Thành viên thừa kế

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

Properties

Length

Có được chiều dài vào trong byte.

public uint Length { get; }

Giá trị bất động sản

uint

ModificationTime

Nhận được ngày và thời gian sửa đổi cuối cùng.

public DateTime ModificationTime { get; }

Giá trị bất động sản

DateTime

Name

Nhận tên vào trong tài liệu.

public string Name { get; }

Giá trị bất động sản

string

Methods

Extract(String)

Xét nhập vào hệ thống tệp theo con đường được cung cấp.

public FileInfo Extract(string path)

Parameters

path string

Đường đến tập tin đích. nếu tập tin đã tồn tại, nó sẽ được viết quá.

Returns

FileInfo

Thông tin file của một file composed.

Examples

using (var archive = new CabArchive("archive.cab"))
{
    archive.Entries[0].Extract("data.bin");
}

Exceptions

ArgumentNullException

path’ is null.

SecurityException

Người gọi không có giấy phép cần thiết để truy cập.

ArgumentException

Đường path’ là trống, chỉ chứa các không gian trắng, hoặc chứa các ký tự vô hiệu.

UnauthorizedAccessException

Truy cập vào tệp path" bị từ chối.

PathTooLongException

Lối đi path", tên tệp, hoặc cả hai vượt quá chiều dài tối đa được xác định bởi hệ thống. Ví dụ, trên nền tảng dựa trên Windows, các con đường phải nhỏ hơn 248 ký tự, và tên tệp phải nhỏ hơn 260 ký tự.

NotSupportedException

Tệp ở path’ chứa một cột (:) ở giữa dòng.

FileNotFoundException

file không được tìm thấy.

DirectoryNotFoundException

Con đường được chỉ định là vô hiệu, chẳng hạn như ở trên một ổ đĩa không được vẽ.

IOException

Tệp đã mở rồi.

NotSupportedException

Việc khởi động dòng chảy thất bại do dữ liệu sai.

InvalidDataException

Tài liệu đã bị phá hủy.

Extract(Stream)

Thu thập nhập vào dòng cung cấp.

public void Extract(Stream destination)

Parameters

destination Stream

Destination stream. phải được viết.

Examples

Tiết xuất một entry từ cab archive.

Using (var archive = new CabArchive("archive.cab"))
{
    archive.Entries[0].Extract(httpResponseStream);
}

Exceptions

ArgumentException

destination’ does not support writing.

NotSupportedException

Việc khởi động dòng chảy thất bại do dữ liệu sai.

InvalidDataException

Tài liệu đã bị phá hủy.

Open()

Mở vào để khai thác và cung cấp một dòng với nội dung nhập.

public Stream Open()

Returns

Stream

dòng mà đại diện cho nội dung của bài đăng.

Examples

Sử dụng :Stream decompressed = entry.Open();

.NET 4.0 và cao hơn - sử dụng phương pháp Stream.CopyTo:decompressed.CopyTo(httpResponse.OutputStream)

.NET 3.5 và trước - sao chép byte bằng tay:

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

 [NotSupportedException](https://learn.microsoft.com/dotnet/api/system.notsupportedexception)

Stream initialization failed due to wrong data.

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

The archive is corrupted.

### <a id="Aspose_Zip_Cab_CabEntry_ToString"></a> ToString\(\)

```csharp
public override string ToString()

Returns

string

 Tiếng Việt