Class CpioArchive

Class CpioArchive

ชื่อพื้นที่: Aspose.Zip.Cpio การประกอบ: Aspose.Zip.dll (25.5.0)

ประเภทนี้เป็นไฟล์ cpio archive

public class CpioArchive : IArchive, IDisposable

Inheritance

object CpioArchive

Implements

IArchive , IDisposable

อนุญาโตตุลาการ

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

Constructors

CpioArchive()

เริ่มต้นตัวอย่างใหม่ของคลาส Aspose.Zip.Cpio.CpioArchive

public CpioArchive()

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการบีบอัดไฟล์

using (var archive = new CpioArchive())
{
    archive.CreateEntry("first.bin", "data.bin");
    archive.Save("archive.cpio");
}

CpioArchive(Stream)

เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Zip.Cpio.CpioArchive และประกอบรายการเข้าที่สามารถสกัดจากเอกสาร

public CpioArchive(Stream sourceStream)

Parameters

sourceStream Stream

แหล่งกําเนิดของเอกสาร มันต้องค้นหา

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นว่าวิธีการดึงรายการทั้งหมดไปยังไดเรกทอรี

using (var archive = new CpioArchive(File.OpenRead("archive.cpio")))
{ 
   archive.ExtractToDirectory("C:\extracted");
}

Remarks

ผู้ก่อสร้างนี้ไม่ถอดรหัสใด ๆ ดู Aspose.Zip.Cpio.CpioEntry.Open วิธีการถอดรหัส

Exceptions

ArgumentNullException

sourceStream’ is null.

ArgumentException

sourceStream’ is not seekable.

InvalidDataException

sourceStream’ is not valid cpio archive.

CpioArchive(รั้ว)

เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Zip.Cpio.CpioArchive และประกอบรายการเข้าที่สามารถสกัดจากเอกสาร

public CpioArchive(string path)

Parameters

path string

เส้นทางไปยังไฟล์ไฟล์

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นว่าวิธีการดึงรายการทั้งหมดไปยังไดเรกทอรี

using (var archive = new CpioArchive("archive.cpio")) 
{ 
   archive.ExtractToDirectory("C:\extracted");
}

Remarks

ผู้ก่อสร้างนี้ไม่ถอดรหัสใด ๆ ดู Aspose.Zip.Cpio.CpioEntry.Open วิธีการถอดรหัส

Exceptions

ArgumentNullException

path’ is null.

SecurityException

ผู้โทรไม่ได้รับอนุญาตให้เข้าถึง

ArgumentException

path" เป็นที่ว่างเปล่ามีพื้นที่สีขาวเท่านั้นหรือมีตัวอักษรที่ไม่ถูกต้อง

UnauthorizedAccessException

การเข้าถึงไฟล์ path" ถูกปฏิเสธ

PathTooLongException

ระบุ path’, ชื่อไฟล์, หรือทั้งสองเกินความยาวสูงสุดที่กําหนดโดยระบบ ตัวอย่างเช่นบนแพลตฟอร์มที่ใช้ Windows, เส้นทางจะต้องน้อยกว่า 248 หมายเลขและชื่อไฟล์จะต้องน้อยกว่า 260 หมายเลข

NotSupportedException

ไฟล์ใน path" มีคอลัมน์ (:) ในส่วนกลางของเส้น

FileNotFoundException

ไฟล์ไม่ได้พบ

DirectoryNotFoundException

เส้นทางที่ระบุไม่ถูกต้องเช่นอยู่บนไดรฟ์ที่ไม่มีแผนที่

IOException

ไฟล์นี้เปิดแล้ว

Properties

Entries

ได้รับป้อนของ Aspose.Zip.Cpio.CpioEntry หมายเลขที่สร้างเอกสาร

public ReadOnlyCollection<cpioentry> Entries { get; }

คุณสมบัติมูลค่า

ReadOnlyCollection < CpioEntry >

Methods

CreateEntries(บอล, บอล)

เพิ่มไฟล์และไดเรกทอรีทั้งหมดในไดเรกทอรี

public CpioArchive CreateEntries(string sourceDirectory, bool includeRootDirectory = true)

Parameters

sourceDirectory string

คู่มือการบีบอัด

includeRootDirectory bool

แสดงให้เห็นว่าจะรวมกล่องรากตัวเองหรือไม่

Returns

CpioArchive

การเข้าสู่ระบบ Cpio

Examples

using (FileStream cpioFile = File.Open("archive.cpio", FileMode.Create))
{
    using (var archive = new CpioArchive())
    {
        archive.CreateEntries("C:\folder", false);
        archive.Save(cpioFile);
    }
}

Exceptions

ArgumentNullException

sourceDirectory’ is null.

SecurityException

ผู้โทรไม่ได้รับอนุญาตที่จําเป็นในการเข้าถึง sourceDirectory'.

ArgumentException

sourceDirectory’ contains invalid characters such as “, <, >, or |.

PathTooLongException

เส้นทางที่ระบุชื่อไฟล์หรือทั้งสองเกินความยาวสูงสุดที่กําหนดโดยระบบ ตัวอย่างเช่นบนแพลตฟอร์มที่ใช้ Windows เส้นทางจะต้องน้อยกว่า 248 หมายเลขและชื่อไฟล์จะต้องน้อยกว่า 260 หมายเลข เส้นทางที่ระบุชื่อไฟล์หรือทั้งสองยาวเกินไป

IOException

sourceDirectory’ stands for a file, not for a directory.

CreateEntries(DirectoryInfo, บอล)

เพิ่มไฟล์และไดเรกทอรีทั้งหมดในไดเรกทอรี

public CpioArchive CreateEntries(DirectoryInfo directory, bool includeRootDirectory = true)

Parameters

directory DirectoryInfo

คู่มือการบีบอัด

includeRootDirectory bool

แสดงให้เห็นว่าจะรวมกล่องรากตัวเองหรือไม่

Returns

CpioArchive

การเข้าสู่ระบบ Cpio

Examples

using (FileStream cpioFile = File.Open("archive.cpio", FileMode.Create))
{
    using (var archive = new CpioArchive())
    {
        archive.CreateEntries(new DirectoryInfo("C:\folder"), false);
        archive.Save(cpioFile);
    }
}

Exceptions

ArgumentNullException

directory’ is null.

SecurityException

ผู้โทรไม่ได้รับอนุญาตที่จําเป็นในการเข้าถึง directory”.

IOException

directory’ stands for a file, not for a directory.

CreateEntry(ลวด, FileInfo, Bool)

สร้างรายการเดียวภายในเอกสาร

public CpioEntry CreateEntry(string name, FileInfo fileInfo, bool openImmediately = false)

Parameters

name string

ชื่อของรายการ

fileInfo FileInfo

metadata ของไฟล์หรือโฟลเดอร์ที่จะถูกบีบอัด

openImmediately bool

จริงๆถ้าคุณเปิดไฟล์ได้ทันทีหรือเปิดไฟล์ที่บันทึกไฟล์

Returns

CpioEntry

การเข้าสู่ระบบ Cpio

Examples

FileInfo fileInfo = new FileInfo("data.bin");
using (var archive = new CpioArchive())
{
    archive.CreateEntry("test.bin", fileInfo);
    archive.Save("archive.cpio");
}

Remarks

หากไฟล์จะเปิดโดยอัตโนมัติโดยใช้พารามิเตอร์จะถูกบล็อกจนกว่าไฟล์จะถูกกําจัด

Exceptions

ArgumentNullException

name’ is null.

ArgumentException

name’ is empty.

ArgumentNullException

fileInfo’ is null.

CreateEntry(string, string, บอล)

สร้างรายการเดียวภายในเอกสาร

public CpioEntry CreateEntry(string name, string sourcePath, bool openImmediately = false)

Parameters

name string

ชื่อของรายการ

sourcePath string

วิธีที่จะไฟล์จะถูกบีบอัด

openImmediately bool

จริงๆถ้าคุณเปิดไฟล์ได้ทันทีหรือเปิดไฟล์ที่บันทึกไฟล์

Returns

CpioEntry

การเข้าสู่ระบบ Cpio

Examples

using (var archive = new CpioArchive())
{
    archive.CreateEntry("first.bin", "data.bin");
    archive.Save("archive.cpio");
}

Remarks

ชื่อเข้าตั้งไว้เฉพาะภายในพารามิเตอร์ ชื่อไฟล์ที่ระบุไว้ในพารามิเตอร์ไม่ส่งผลต่อชื่อเข้า

หากไฟล์จะเปิดโดยอัตโนมัติโดยใช้พารามิเตอร์จะถูกบล็อกจนกว่าไฟล์จะถูกกําจัด

Exceptions

ArgumentNullException

sourcePath’ is null.

SecurityException

ผู้โทรไม่ได้รับอนุญาตให้เข้าถึง

ArgumentException

sourcePath’ เป็นว่างเปล่ามีพื้นที่สีขาวเท่านั้นหรือมีตัวอักษรที่ไม่ถูกต้อง - หรือ - ชื่อไฟล์เป็นส่วนหนึ่งของ name’, มากกว่า 100 ตัวอักษร

UnauthorizedAccessException

การเข้าถึงไฟล์ sourcePath" ถูกปฏิเสธ

PathTooLongException

ระบุ sourcePath’, ชื่อไฟล์, หรือทั้งสองเกินความยาวสูงสุดที่กําหนดโดยระบบ ตัวอย่างเช่นบนแพลตฟอร์มที่ใช้ Windows, เส้นทางจะต้องน้อยกว่า 248 หมายเลขและชื่อไฟล์จะต้องน้อยกว่า 260 หมายเลข - หรือ - name’ เป็นยาวเกินไปสําหรับ cpio.

NotSupportedException

ไฟล์ที่ sourcePath’ มีคอลัมน์ (:) ในส่วนกลางของเส้น

CreateEntry(กระแส, กระแส)

สร้างรายการเดียวภายในเอกสาร

public CpioEntry CreateEntry(string name, Stream source)

Parameters

name string

ชื่อของรายการ

source Stream

การเข้าสู่ระบบสําหรับเข้าสู่ระบบ

Returns

CpioEntry

การเข้าสู่ระบบ Cpio

Examples

using (var archive = new CpioArchive())
{
    archive.CreateEntry("data.bin", File.OpenRead("data.bin"));
    archive.Save("archive.cpio");
}

Exceptions

ArgumentNullException

name’ is null.

ArgumentNullException

source’ is null.

ArgumentException

name’ is empty.

DeleteEntry(CpioEntry)

ลบการปรากฏตัวครั้งแรกของรายการที่เฉพาะเจาะจงจากรายการรายการ

public CpioArchive DeleteEntry(CpioEntry entry)

Parameters

entry CpioEntry

การเข้าสู่ระบบที่จะถอดออกจากรายการเข้าสู่ระบบ

Returns

CpioArchive

การเข้าสู่ระบบ Cpio

Examples

นี่คือวิธีที่คุณสามารถลบรายการทั้งหมดยกเว้นครั้งสุดท้าย:

using (var archive = new CpioArchive("archive.cpio"))
{
    while (archive.Entries.Count &gt; 1)
        archive.DeleteEntry(archive.Entries[0]);
    archive.Save(outputCpioFile);
}

Exceptions

ArgumentNullException

entry’ is null.

DeleteEntry(int)

ลบป้อนจากรายการป้อนโดย index

public CpioArchive DeleteEntry(int entryIndex)

Parameters

entryIndex int

อัตราการเข้าสู่ระบบที่ต้องถูกลบ

Returns

CpioArchive

ไฟล์ที่มีการเข้าสู่ระบบลบ

Examples

using (var archive = new CpioArchive("two_files.cpio"))
{
    archive.DeleteEntry(0);
    archive.Save("single_file.cpio");
}

Exceptions

ArgumentOutOfRangeException

entryIndex’ is less than 0.-or- entryIndex’ is equal to or greater than ‘Entries’ count.

Dispose()

ทําหน้าที่ที่กําหนดโดยการใช้งานที่เกี่ยวข้องกับการปล่อยทรัพยากรที่ไม่ได้รับการจัดการหรือรีไซเคิล

public void Dispose()

Dispose(บอล)

ทําหน้าที่ที่กําหนดโดยการใช้งานที่เกี่ยวข้องกับการปล่อยทรัพยากรที่ไม่ได้รับการจัดการหรือรีไซเคิล

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

ไม่ว่าทรัพยากรที่จัดการควรจะถูกกําจัด

ExtractToDirectory(รั้ว)

extract all the files in the archive to the directory provided

public void ExtractToDirectory(string destinationDirectory)

Parameters

destinationDirectory string

เส้นทางไปยังไดเรกทอรีเพื่อวางไฟล์ที่สกัด

Examples

using (var archive = new CpioArchive("archive.cpio")) 
{ 
   archive.ExtractToDirectory("C:\extracted");
}

Remarks

หากไดเรกทอรีไม่ได้มีมันจะถูกสร้างขึ้น

Exceptions

ArgumentNullException

เส้นทางเป็นศูนย์

PathTooLongException

เส้นทางที่ระบุชื่อไฟล์หรือทั้งสองเกินความยาวสูงสุดที่กําหนดโดยระบบ ตัวอย่างเช่นบนแพลตฟอร์มที่ใช้ Windows เส้นทางจะต้องน้อยกว่า 248 หมายเลขและชื่อไฟล์จะต้องน้อยกว่า 260 หมายเลข

SecurityException

ผู้โทรไม่ได้รับอนุญาตที่จําเป็นในการเข้าถึงไดเรกทอรีที่มีอยู่

NotSupportedException

หากไดเรกทอรีไม่ได้มีเส้นทางมีตัวอักษรของ colon (:) ซึ่งไม่ได้เป็นส่วนหนึ่งของแท็กไดรฟ์ (“C:”).

ArgumentException

เส้นผ่านศูนย์กลางเป็นเส้นผ่าศูนย์กลางมีพื้นที่สีขาวเท่านั้นหรือมีตัวอักษรที่ไม่ถูกต้องหนึ่งหรือหลายตัว คุณสามารถค้นหาตัวอักษรที่ไม่ถูกต้องโดยใช้วิธีการ System.IO.Path.GetInvalidPathChars เส้นผ่านศูนย์กลาง - หรือเส้นผ่านศูนย์กลางที่มีหรือมีตัวอักษร colon (: )เท่านั้น

IOException

แผนที่ที่ระบุโดยเส้นทางเป็นไฟล์ -หรือ- ชื่อเครือข่ายไม่ทราบ

Save(รั้ว, CpioFormat)

บันทึกไฟล์ไปยังไฟล์ปลายทางที่ให้

public void Save(string destinationFileName, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

destinationFileName string

วิธีของไฟล์ที่จะสร้าง หากชื่อไฟล์ที่ระบุหมายถึงไฟล์ที่มีอยู่มันจะถูกเขียนเกินไป

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (var archive = new CpioArchive())
{
    archive.CreateEntry("entry1", "data.bin");        
    archive.Save("archive.cpio");
}

Remarks

มันเป็นไปได้ที่จะบันทึกไฟล์ไปยังเส้นทางเดียวกันเมื่อมันถูกโหลด จาก อย่างไรก็ตามนี่ไม่แนะนําเพราะวิธีการนี้ใช้การคัดลอกไปยังไฟล์ชั่วคราว

Exceptions

ArgumentException

destinationFileName’ is a zero-length string, contains only white space, or contains one or more invalid characters as defined by System.IO.Path.InvalidPathChars.

ArgumentNullException

destinationFileName’ is null.

PathTooLongException

คําอธิบาย destinationFileName’, ชื่อไฟล์, หรือทั้งสองเกินความยาวสูงสุดที่กําหนดโดยระบบ ตัวอย่างเช่นบนแพลตฟอร์มที่ใช้ Windows, เส้นทางจะต้องน้อยกว่า 248 หมายเลขและชื่อไฟล์จะต้องน้อยกว่า 260 หมายเลข

DirectoryNotFoundException

ระบุ destinationFileName’ เป็น invalid, (เช่นมันอยู่ในไดรฟ์ที่ไม่ได้วาด)

IOException

ข้อผิดพลาด I / O ได้เกิดขึ้นเมื่อเปิดไฟล์

UnauthorizedAccessException

destinationFileName’Specified a file is read-only and access is not Read.-or- path specified a directory.-or- The caller does not have the required permission.

NotSupportedException

destinationFileName’ is in an invalid format.

Save(กระแส, CpioFormat)

เก็บไฟล์ไปยังกระแสที่ให้

public void Save(Stream output, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

output Stream

การไหลของเป้าหมาย

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (FileStream cpioFile = File.Open("archive.cpio", FileMode.Create))
{
    using (var archive = new CpioArchive())
    {
        archive.CreateEntry("entry1", "data.bin");        
        archive.Save(cpioFile);
    }
}

Remarks

จําเป็นต้องเขียนได้

Exceptions

ArgumentNullException

output’ is null.

ArgumentException

output’ is not writable. - or - output’ is the same stream we extract from.- OR -It is impossible to save archive in cpioFormat’ due to format restrictions.

SaveGzipped(กระแส, CpioFormat)

เก็บไฟล์ไปยังกระแสโดยใช้การบีบอัด gzip

public void SaveGzipped(Stream output, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

output Stream

การไหลของเป้าหมาย

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (FileStream result = File.OpenWrite("result.cpio.gz"))
{
    using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
    {
        using (var archive = new CpioArchive())
        {
            archive.CreateEntry("entry.bin", source);
            archive.SaveGzipped(result);
        }
    }
}

Remarks

จําเป็นต้องเขียนได้

Exceptions

ArgumentNullException

output’ is null.

ArgumentException

output’ is not writable.

SaveGzipped(รั้ว, CpioFormat)

เก็บไฟล์ไปยังไฟล์ตามเส้นทางโดยใช้การบีบอัด gzip

public void SaveGzipped(string path, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

path string

วิธีของไฟล์ที่จะสร้าง หากชื่อไฟล์ที่ระบุหมายถึงไฟล์ที่มีอยู่มันจะถูกเขียนเกินไป

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
{
    using (var archive = new CpioArchive())
    {
        archive.CreateEntry("entry.bin", source);
        archive.SaveGzipped("result.cpio.gz");
    }
}

ป้องกันการบีบอัด(กระแส, CpioFormat)

เก็บไฟล์ไปยังกระแสโดยใช้การบีบอัด LZMA

public void SaveLZMACompressed(Stream output, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

output Stream

การไหลของเป้าหมาย

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (FileStream result = File.OpenWrite("result.cpio.lzma"))
{
    using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
    {
        using (var archive = new CpioArchive())
        {
            archive.CreateEntry("entry.bin", source);
            archive.SaveLZMACompressed(result);
        }
    }
}

Remarks

จําเป็นต้องเขียนได้

สิ่งสําคัญ: ไฟล์ cpio จะถูกประกอบแล้วบีบอัดภายในวิธีการนี้เนื้อหาของมันจะถูกเก็บไว้ภายใน ระมัดระวังการบริโภคหน่วยความจํา

ป้องกันการบีบอัด(รั้ว, CpioFormat)

เก็บไฟล์ไปยังไฟล์โดยทางด้วย lzma การบีบอัด

public void SaveLZMACompressed(string path, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

path string

วิธีของไฟล์ที่จะสร้าง หากชื่อไฟล์ที่ระบุหมายถึงไฟล์ที่มีอยู่มันจะถูกเขียนเกินไป

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
{
    using (var archive = new CpioArchive())
    {
        archive.CreateEntry("entry.bin", source);
        archive.SaveLZMACompressed("result.cpio.lzma");
    }
}

Remarks

สิ่งสําคัญ: ไฟล์ cpio จะถูกประกอบแล้วบีบอัดภายในวิธีการนี้เนื้อหาของมันจะถูกเก็บไว้ภายใน ระมัดระวังการบริโภคหน่วยความจํา

SaveLzipped(กระแส, CpioFormat)

เก็บไฟล์ไปยังกระแสด้วย lzip compression

public void SaveLzipped(Stream output, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

output Stream

การไหลของเป้าหมาย

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (FileStream result = File.OpenWrite("result.cpio.lz"))
{
    using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
    {
        using (var archive = new CpioArchive())
        {
            archive.CreateEntry("entry.bin", source);
            archive.SaveGzipped(result);
        }
    }
}

Remarks

จําเป็นต้องเขียนได้

Exceptions

ArgumentNullException

output’ is null.

ArgumentException

output’ is not writable.

SaveLzipped(รั้ว, CpioFormat)

เก็บไฟล์ไปยังไฟล์ตามเส้นทางด้วย lzip compression

public void SaveLzipped(string path, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

path string

วิธีของไฟล์ที่จะสร้าง หากชื่อไฟล์ที่ระบุหมายถึงไฟล์ที่มีอยู่มันจะถูกเขียนเกินไป

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
{
    using (var archive = new CpioArchive())
    {
        archive.CreateEntry("entry.bin", source);
        archive.SaveGzipped("result.cpio.lz");
    }
}

SaveXzCompressed(กระแส, CpioFormat, XzArchiveSettings)

เก็บไฟล์ไปยังกระแสโดยใช้การบีบอัด xz

public void SaveXzCompressed(Stream output, CpioFormat cpioFormat = CpioFormat.OldAscii, XzArchiveSettings settings = null)

Parameters

output Stream

การไหลของเป้าหมาย

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

settings XzArchiveSettings

ชุดการตั้งค่าของเอกสาร XZ ที่เฉพาะเจาะจง: ขนาดคําพูด, ขนาดบล็อก, ประเภทตรวจสอบ

Examples

using (FileStream result = File.OpenWrite("result.cpio.xz"))
{
    using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
    {
        using (var archive = new CpioArchive())
        {
            archive.CreateEntry("entry.bin", source);
            archive.SaveXzCompressed(result);
        }
    }
}

Remarks

กระแสควรจะเขียนได้

Exceptions

ArgumentNullException

output’ is null.

ArgumentException

output’ is not writable.

SaveXzCompressed(ลวด, CpioFormat, XzArchiveSettings)

เก็บไฟล์ไปยังเส้นทางโดยเส้นทางโดยการบีบอัด xz

public void SaveXzCompressed(string path, CpioFormat cpioFormat = CpioFormat.OldAscii, XzArchiveSettings settings = null)

Parameters

path string

วิธีของไฟล์ที่จะสร้าง หากชื่อไฟล์ที่ระบุหมายถึงไฟล์ที่มีอยู่มันจะถูกเขียนเกินไป

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

settings XzArchiveSettings

ชุดการตั้งค่าของเอกสาร XZ ที่เฉพาะเจาะจง: ขนาดคําพูด, ขนาดบล็อก, ประเภทตรวจสอบ

Examples

using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
{
    using (var archive = new CpioArchive())
    {
        archive.CreateEntry("entry.bin", source);
        archive.SaveXzCompressed("result.cpio.xz");
    }
}

บันทึก(กระแส, CpioFormat)

เก็บไฟล์ไปยังกระแสโดยใช้การบีบอัด Z

public void SaveZCompressed(Stream output, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

output Stream

การไหลของเป้าหมาย

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (FileStream result = File.OpenWrite("result.cpio.Z"))
{
    using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
    {
        using (var archive = new CpioArchive())
        {
            archive.CreateEntry("entry.bin", source);
            archive.SaveZCompressed(result);
        }
    }
}

Remarks

จําเป็นต้องเขียนได้

Exceptions

ArgumentNullException

output’ is null.

ArgumentException

output’ is not writable.

บันทึก(รั้ว, CpioFormat)

เก็บไฟล์ไปยังเส้นทางตามเส้นทางด้วยการบีบอัด Z

public void SaveZCompressed(string path, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

path string

วิธีของไฟล์ที่จะสร้าง หากชื่อไฟล์ที่ระบุหมายถึงไฟล์ที่มีอยู่มันจะถูกเขียนเกินไป

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
{
    using (var archive = new CpioArchive())
    {
        archive.CreateEntry("entry.bin", source);
        archive.SaveZCompressed("result.cpio.Z");
    }
}

SaveZstandard(กระแส, CpioFormat)

เก็บไฟล์ไปยังกระแสโดยใช้การบีบอัดมาตรฐาน

public void SaveZstandard(Stream output, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

output Stream

การไหลของเป้าหมาย

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (FileStream result = File.OpenWrite("result.cpio.zst"))
{
    using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
    {
        using (var archive = new CpioArchive())
        {
            archive.CreateEntry("entry.bin", source);
            archive.SaveZstandard(result);
        }
    }
}

Remarks

จําเป็นต้องเขียนได้

Exceptions

ArgumentNullException

output’ is null.

ArgumentException

output’ is not writable.

SaveZstandard(รั้ว, CpioFormat)

เก็บไฟล์ไปยังไฟล์ตามเส้นทางด้วยการบีบอัดมาตรฐาน

public void SaveZstandard(string path, CpioFormat cpioFormat = CpioFormat.OldAscii)

Parameters

path string

วิธีของไฟล์ที่จะสร้าง หากชื่อไฟล์ที่ระบุหมายถึงไฟล์ที่มีอยู่มันจะถูกเขียนเกินไป

cpioFormat CpioFormat

การกําหนดรูปแบบ cpio header

Examples

using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
{
    using (var archive = new CpioArchive())
    {
        archive.CreateEntry("entry.bin", source);
        archive.SaveZstandard("result.cpio.zst");
    }
}
 แบบไทย