Class XarFileEntry

Class XarFileEntry

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

Hiển thị file entry trong xar archive.

public sealed class XarFileEntry : XarEntry, IArchiveFileEntry

Inheritance

object XarEntry XarFileEntry

Implements

IArchiveFileEntry

Thành viên thừa kế

XarEntry.ToString() , XarEntry.Name , XarEntry.FullPath , XarEntry.IsDirectory , XarEntry.Parent , XarEntry.CreationTime , XarEntry.LastAccessTime , XarEntry.LastWriteTime , XarEntry.ModificationTime , 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 long Length { get; }

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

long

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 file composed.

Examples

using (var archive = new XarArchive("archive.xar"))
{
    ((XarFileEntry)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.

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

Nhập một bài đăng từ ARCHIVE ARCHIVE

using (var archive = new XarArchive("archive.xar"))
{
    ((XarFileEntry)archive.Entries[0]).Extract(httpResponseStream);
}

Exceptions

ArgumentException

destination’ does not support writing.

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.

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

Raises when a portion of raw stream compressed.

```csharp
public event EventHandler<progresseventargs> CompressionProgressed

Sự kiện Type

EventHandler < ProgressEventArgs >

Examples

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

Remarks

Người gửi sự kiện là một trường hợp Aspose.Zip.Xar.XarFileEntry.

 Tiếng Việt