Class ArchiveEntry

Class ArchiveEntry

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

アーカイブ内の単一ファイルを表示します。

public abstract class ArchiveEntry : IArchiveFileEntry

Inheritance

object ArchiveEntry

Derived

ArchiveEntryEncrypted , ArchiveEntryPlain

Implements

IArchiveFileEntry

相続人

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

Remarks

Aspose.Zip.ArchiveEntry インストールを Aspose.Zip.ArchiveEntry に暗号化して、入力が暗号化されているかどうかを確認します。

Constructors

ArchiveEntry(ストリーム, CompressionSettings, Funcウィンツ)

Aspose.Zip.ArchiveEntryクラスの新しい例を開始します。

protected ArchiveEntry(string name, CompressionSettings compressionSettings, Func<stream> sourceProvider, uint fileAttributes)

Parameters

name string

入場名

compressionSettings CompressionSettings

圧縮または圧縮のための設定

sourceProvider Func < Stream >

入力データを含む流を返す方法も圧縮される。

fileAttributes uint

ファイルシステムの特性

ArchiveEntry(ストリーム, CompressionSettings, Stream, uint, FileSystemInfo)

Aspose.Zip.ArchiveEntryクラスの新しい例を開始します。

protected ArchiveEntry(string name, CompressionSettings compressionSettings, Stream source, uint fileAttributes, FileSystemInfo fileInfo = null)

Parameters

name string

入場名

compressionSettings CompressionSettings

圧縮または圧縮のための設定

source Stream

入力データの流れは、圧縮されるか、圧縮されるか。

fileAttributes uint

ファイルシステムの特性

fileInfo FileSystemInfo

ファイルまたはディレクトリは、入力に基づく情報を提供します。

Properties

Comment

アーカイブ内の入力に関するコメントを受け取ります。

public string Comment { get; protected set; }

不動産価値

string

CompressedSize

圧縮されたファイルのサイズを取得します。

public ulong CompressedSize { get; }

不動産価値

ulong

CompressionSettings

圧縮または圧縮のための設定を取得します。

public CompressionSettings CompressionSettings { get; }

不動産価値

CompressionSettings

DataSource

エントリーのソースがアーカイブに追加された場合、抽出されていません。

public Stream DataSource { get; }

不動産価値

Stream

Remarks

割り当て前に、ソースはゼロです このソースは、いくつかのケースで「Archive.Save」方法で割り当てられます。

FileAttributes

ホストシステムからファイル属性を取得します。

protected FileAttributes FileAttributes { get; }

不動産価値

FileAttributes

IsDirectory

入力がディレクトリであるかどうかを示す値を得る。

public bool IsDirectory { get; }

不動産価値

bool

ModificationTime

最後に変更された日付と時間を取得または設定します。

public DateTime ModificationTime { get; set; }

不動産価値

DateTime

Name

アーカイブ内の入力の名前を入力します。

public string Name { get; protected set; }

不動産価値

string

UncompressedSize

オリジナルのファイルのサイズを取得します。

public ulong UncompressedSize { get; }

不動産価値

ulong

Methods

Extract(ストリップ、ストリップ)

ファイルシステムへの入り口を提供されたルートで抽出します。

public FileInfo Extract(string path, string password = null)

Parameters

path string

ターゲットファイルへのルート. ファイルが既に存在している場合、それは過剰に書かれます。

password string

暗号化のための選択肢パスワード

Returns

FileInfo

コンポーネントファイルの情報

Examples

ZIPアーカイブの2つのエントリーを抽出し、それぞれ自分のパスワードを持っています。

using (FileStream zipFile = File.Open("archive.zip", FileMode.Open))
{
    using (Archive archive = new Archive(zipFile))
    {
        archive.Entries[0].Extract("first.bin", "first_pass");
        archive.Entries[1].Extract("second.bin", "second_pass");
    }
}

Exceptions

ArgumentNullException

path’ is null.

SecurityException

通話者には、必要なアクセス許可はありません。

ArgumentException

path’ は空っぽで、白いスペースのみが含まれ、または無効な文字が含まれています。

UnauthorizedAccessException

path" ファイルへのアクセスは拒否されます。

PathTooLongException

指定された path’, ファイル名, または両方ともシステム定義の最大長さを超えています. たとえば、Windows ベースのプラットフォームでは、パスは 248 文字未満で、ファイル名は 260 文字未満でなければなりません。

NotSupportedException

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

FileNotFoundException

ファイルは見つかりません。

DirectoryNotFoundException

指定されたルートは無効です、例えば、マッピングされていないドライブにあります。

IOException

ファイルはすでに開いています。

InvalidDataException

データは腐敗しています. -or- CRC または MAC 検証は入力に失敗しました。

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

提供された流れへの入り口を抽出します。

public void Extract(Stream destination, string password = null)

Parameters

destination Stream

目的地の流れは、書くべきです。

password string

暗号化のための選択肢パスワード

Examples

パスワードでZIPアーカイブの入力を抽出します。

using (FileStream zipFile = File.Open("archive.zip", FileMode.Open))
{
    using (Archive archive = new Archive(zipFile))
    {
        archive.Entries[0].Extract(httpResponseStream, "p@s$");
    }
}

Exceptions

InvalidDataException

データは腐敗しています. -or- CRC または MAC 検証は入力に失敗しました。

IOException

情報源は腐敗しているか、読めないか。

ArgumentException

destination’ does not support writing.

Open(ストレッチ)

抽出のためのエントリーを開き、デコンプレッシャーされたエントリーコンテンツの流れを提供します。

public Stream Open(string password = null)

Parameters

password string

暗号化のための選択肢パスワード

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 &lt; (bytesRead = decompressed.Read(buffer, 0, buffer.Length)))
 fileStream.Write(buffer, 0, bytesRead);
```</p>

#### Remarks

<p>Read from the stream to get the original content of a file. See examples section.</p>

#### Exceptions

 [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception)

The archive is in an incorrect state.

### <a id="Aspose_Zip_ArchiveEntry_CompressionProgressed"></a> CompressionProgressed

Raises when a portion of raw stream compressed.

```csharp
public event EventHandler<progresseventargs> CompressionProgressed

イベントタイプ

EventHandler < ProgressEventArgs >

Examples

archive.Entries[0].CompressionProgressed += (s, e) =&gt; { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };

Remarks

イベントメッセンジャーは Aspose.Zip.ArchiveEntry インスタンスです。

ExtractionProgressed

原料の一部が抽出されたときに増加します。

public event EventHandler<progresseventargs> ExtractionProgressed

イベントタイプ

EventHandler < ProgressEventArgs >

Examples

archive.Entries[0].ExtractionProgressed += (s, e) =&gt; { int percent = (int)((100 * e.ProceededBytes) / ((ArchiveEntry)s).UncompressedSize); };

Remarks

イベントメッセンジャーは Aspose.Zip.ArchiveEntry インスタンスです。

 日本語