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.Longth

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

จุดหมายปลายทาง Stream. ต้องการเขียนได้

Examples

extract entry ของ tar archive.

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.
 แบบไทย