Class TarEntry

Class TarEntry

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

在 Tar 档案中显示单个文件。

public class TarEntry : IArchiveFileEntry

Inheritance

object TarEntry

Implements

IArchiveFileEntry

继承人

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

Properties

IsDirectory

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

public bool IsDirectory { get; }

财产价值

bool

Length

获取入口长度在比特。

public long Length { get; }

财产价值

long

ModificationTime

收到文件或目录的修改时间。

public DateTime ModificationTime { get; }

财产价值

DateTime

Name

收到或在档案中输入的名称。

public string Name { get; set; }

财产价值

string

UncompressedSize

得到原始文件的尺寸。

public long UncompressedSize { get; }

财产价值

long

Remarks

与 Aspose.Zip.Tar.TarEntry.长度相同的值

Methods

Extract(线条)

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

public FileSystemInfo Extract(string path)

Parameters

path string

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

Returns

FileSystemInfo

组成文件的文件信息。

Examples

using (var archive = new TarArchive("archive.tar"))
{
    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

提取TAR档案的输入。

using (var archive = new TarArchive("archive.tar"))
{
    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.
 中文