Class XarFileEntry
名称: Aspose.Zip.Xar 收藏: Aspose.Zip.dll (25.5.0)
代表在 xar 档案中的文件输入。
public sealed class XarFileEntry : XarEntry, IArchiveFileEntry
Inheritance
object ← XarEntry ← XarFileEntry
Implements
继承人
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
接收入口的长度为比特。
public long Length { get; }
财产价值
Methods
Extract(线条)
通过提供的路径将输入到文件系统。
public FileInfo Extract(string path)
Parameters
path
string
路径到目的地文件. 如果文件已经存在,它将被过写。
Returns
组成文件的文件信息。
Examples
using (var archive = new XarArchive("archive.xar"))
{
((XarFileEntry)archive.Entries[0]).Extract("data.bin");
}
Exceptions
path’ is null.
召唤者没有所需的访问许可。
path’ 是空的,只包含白色空间,或包含无效的字符。
拒绝访问 path" 文件。
指定的 path’, 文件名, 或两者都超过系统定义的最大长度. 例如,在基于 Windows 的平台上,路径必须小于 248 个字符, 文件名必须小于 260 个字符。
文件在 path’ 中间包含一个列(:)。
档案被腐败了。
Extract(Stream)
将输入到提供的流。
public void Extract(Stream destination)
Parameters
destination
Stream
目的地流,必须写作。
Examples
从 xar 档案中提取一个输入。
using (var archive = new XarArchive("archive.xar"))
{
((XarFileEntry)archive.Entries[0]).Extract(httpResponseStream);
}
Exceptions
destination’ does not support writing.
档案被腐败了。
Open()
打开输入用于提取,并提供输入内容的流。
public Stream Open()
Returns
代表入口内容的流。
Examples
使用:Stream decompressed = entry.Open();
.NET 4.0 或更高版本 - 使用 Stream.CopyTo 方法:decompressed.CopyTo(httpResponse.OutputStream)
.NET 3.5 和之前 - 手动复制比特:
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
事件类型
EventHandler < ProgressEventArgs >
Examples
archive.Entries.First().CompressionProgressed += (s, e) => { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };
Remarks
事件发送器是一个 Aspose.Zip.Xar.XarFileEntry 例子。