CpioArchive.DeleteEntry

DeleteEntry(CpioEntry)

エントリ リストから特定のエントリの最初の出現を削除します。

public CpioArchive DeleteEntry(CpioEntry entry)
パラメータタイプ説明
entryCpioEntryエントリ リストから削除するエントリ。

戻り値

Cpio エントリ インスタンス。

例外

例外調子
ArgumentNullExceptionentry無効である。

最後のエントリを除くすべてのエントリを削除する方法は次のとおりです。

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

関連項目


DeleteEntry(int)

インデックスによってエントリ リストからエントリを削除します。

public CpioArchive DeleteEntry(int entryIndex)
パラメータタイプ説明
entryIndexInt32削除するエントリのゼロから始まるインデックス。

戻り値

エントリが削除されたアーカイブ。

例外

例外調子
ArgumentOutOfRangeExceptionentryIndexは 0 未満です。-または-entryIndex等しいかより大きいエントリーカウント。

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

関連項目