CpioArchive.SaveGzipped

SaveGzipped(Stream, CpioFormat)

gzip 圧縮でアーカイブをストリームに保存します。

public void SaveGzipped(Stream output, CpioFormat cpioFormat = CpioFormat.OldAscii)
パラメータタイプ説明
outputStream宛先ストリーム。
cpioFormatCpioFormatcpio ヘッダー形式を定義します。

例外

例外調子
ArgumentNullExceptionoutput無効である。
ArgumentExceptionoutput書き込み不可です。

備考

output書き込み可能でなければなりません。

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);
        }
    }
}

関連項目


SaveGzipped(string, CpioFormat)

アーカイブを gzip 圧縮のパスでファイルに保存します。

public void SaveGzipped(string path, CpioFormat cpioFormat = CpioFormat.OldAscii)
パラメータタイプ説明
pathString作成するアーカイブのパス。指定したファイル名が既存のファイルを指している場合、上書きされます。
cpioFormatCpioFormatcpio ヘッダー形式を定義します。

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

関連項目