Class CpioEntry

Class CpioEntry

名称: Aspose.Zip.Cpio 收藏: Aspose.Zip.dll (25.5.0)

在 cpio 档案中代表单个文件。

public sealed class CpioEntry : IArchiveFileEntry

Inheritance

object CpioEntry

Implements

IArchiveFileEntry

继承人

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

Properties

IsDirectory

收到一个值,表明输入是否代表一个目录。

public bool IsDirectory { get; }

财产价值

bool

LastWriteTimeUtc

得到了最后写作时间。

public DateTime LastWriteTimeUtc { get; }

财产价值

DateTime

Length

接收入口的长度为比特。

public long Length { get; }

财产价值

long

Name

收到存档中的输入名称。

public string Name { get; }

财产价值

string

Parent

获取所属的档案。

public CpioArchive Parent { get; }

财产价值

CpioArchive

Methods

Extract(线条)

通过提供的路径将输入到文件系统。

public FileSystemInfo Extract(string path)

Parameters

path string

路径到目的地文件. 如果文件已经存在,它将被过写。

Returns

FileSystemInfo

组成文件的文件信息。

Examples

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

Exceptions

ArgumentNullException

path’ is null.

SecurityException

召唤者没有所需的访问许可。

ArgumentException

path’ 是空的,只包含白色空间,或包含无效的字符。

UnauthorizedAccessException

拒绝访问 path" 文件。

PathTooLongException

指定的 path’, 文件名, 或两者都超过系统定义的最大长度. 例如,在基于 Windows 的平台上,路径必须小于 248 个字符, 文件名必须小于 260 个字符。

NotSupportedException

文件在 path’ 中间包含一个列(:)。

FileNotFoundException

文件未找到。

DirectoryNotFoundException

指定的路径是无效的,例如在无地图驱动器上。

IOException

文件已经开放了。

Extract(Stream)

将输入到提供的流。

public void Extract(Stream destination)

Parameters

destination Stream

目的地流,必须写作。

Examples

提取 cpio 档案的输入。

using (var archive = new CpioArchive("archive.cpio"))
{
    archive.Entries[0].Extract(httpResponseStream);
}

Exceptions

ArgumentException

destination’ does not support writing.

Open()

打开输入用于提取,并提供输入内容的流。

public Stream Open()

Returns

Stream

代表入口内容的流。

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_Cpio_CpioEntry_ToString"></a> ToString\(\)

```csharp
public override string ToString()

Returns

string

 中文