Class CpioArchive

Class CpioArchive

名称: Aspose.Zip.Cpio 組み合わせ: Aspose.Zip.dll (25.5.0)

このクラスはCPIOファイルを表しています。

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.Cpioアーカイブクラスの新しい例を開始します。

public CpioArchive()

Examples

下記の例では、ファイルを圧縮する方法を示しています。

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

CpioArchive(Stream)

Aspose.Zip.Cpio.Cpioアーカイブクラスの新しい例を開始し、アーカイブから抽出できる入力リストを構成します。

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.Cpioアーカイブクラスの新しい例を開始し、アーカイブから抽出できる入力リストを構成します。

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

インストールインストール

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(ディレクトリ情報、ボール)

アーカイブにすべてのファイルとディレクトリを繰り返し追加します。

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

Parameters

directory DirectoryInfo

コンプレッシャーディレクトリ

includeRootDirectory bool

ルートディレクトリ自体を含むか否かを示す。

Returns

CpioArchive

インストールインストール

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

通話者は、コードクラス=“paramref”>ディレクトリにアクセスするために必要な許可はありません。

IOException

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

CreateEntry(ストリップ、ファイルインフォ、ボール)

ファイル内で単一のエントリーを作成します。

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

Parameters

name string

入り口の名前。

fileInfo FileInfo

ファイルまたはフォルダーのメタデータが圧縮される。

openImmediately bool

確かに、すぐにファイルを開く場合は、ファイルをアーカイブ保存で開きます。

Returns

CpioEntry

インストールインストール

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(ストリップ、ストリップ、ボール)

ファイル内で単一のエントリーを作成します。

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

Parameters

name string

入り口の名前。

sourcePath string

ファイルを圧縮する方法

openImmediately bool

確かに、すぐにファイルを開く場合は、ファイルをアーカイブ保存で開きます。

Returns

CpioEntry

インストールインストール

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

例えば、Windows ベースのプラットフォームでは、パスは 248 文字未満で、ファイル名は 260 文字未満でなければなりません。

NotSupportedException

sourcePath’ のファイルには、列の真ん中のコロン(:)が含まれています。

CreateEntry(ストリーム、ストリーム)

ファイル内で単一のエントリーを作成します。

public CpioEntry CreateEntry(string name, Stream source)

Parameters

name string

入り口の名前。

source Stream

入り口への入り口の流れ

Returns

CpioEntry

インストールインストール

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

インストールインストール

Examples

以下は、最後の1を除くすべての投稿を削除する方法です。

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(インタ)

入力リストからインデックスで入力を削除します。

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(ストレッチ)

アーカイブのすべてのファイルを提供されたディレクトリに抽出します。

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

ディレクトリが存在しない場合、コースには、ドライブラベル(「C:」)の一部ではないコロン文字(:)が含まれています。

ArgumentException

パスはゼロの長さの線であり、白いスペースのみを含み、あるいは1つまたは複数の無効な文字を含みます. System.IO.Path.GetInvalidPathChars メソッドを使用して無効な文字を求めることができます. -or- パスは、単一のコロン文字(: )で事前に設定されています。

IOException

ルートによって指定されたディレクトリはファイルです. -or- ネットワーク名は知られていません。

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’ は無効です(例えば、マッピングされていないドライブにあります)。

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 圧縮でストリームにアーカイブを保存します。

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 圧縮でファイルにアーカイブを保存します。

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)

ストリームにアーカイブを保存する Zstandard 圧縮。

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");
    }
}
 日本語