Class XarFileEntry

Class XarFileEntry

Název místa: Aspose.Zip.Xar Sbírka: Aspose.Zip.dll (25.5.0)

Zobrazuje souborový vstup v archivu xar.

public sealed class XarFileEntry : XarEntry, IArchiveFileEntry

Inheritance

object XarEntry XarFileEntry

Implements

IArchiveFileEntry

Dědiční členové

XarEntry.ToString() , XarEntry.Name , XarEntry.FullPath , XarEntry.IsDirectory , XarEntry.Parent , XarEntry.CreationTime , XarEntry.LastAccessTime , XarEntry.LastWriteTime , XarEntry.ModificationTime , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Properties

Length

Obdrží délku vstupu v bytech.

public long Length { get; }

Hodnota nemovitosti

long

Methods

Extract(Stringová)

Vkládá vstup do souborového systému poskytnutou cestou.

public FileInfo Extract(string path)

Parameters

path string

Cesta k cílovému souboru.Pokud soubor již existuje, bude přepsan.

Returns

FileInfo

Informace o složení souboru.

Examples

using (var archive = new XarArchive("archive.xar"))
{
    ((XarFileEntry)archive.Entries[0]).Extract("data.bin");
}

Exceptions

ArgumentNullException

path’ is null.

SecurityException

Zákazník nemá požadované povolení k přístupu.

ArgumentException

code class=“paramref”>path’ je prázdný, obsahuje pouze bílé prostory, nebo obsahuje neplatné znaky.

UnauthorizedAccessException

Přístup k souboru path" je odmítnut.

PathTooLongException

Uvedený path", název souboru, nebo oba překračují maximální délku definovanou systémem. Například na platformách založených na Windows, trasy musí být méně než 248 znaků a názvy souboru musí být méně než 260 znak.

NotSupportedException

Soubor na path’ obsahuje kolonu (:) uprostřed řádku.

InvalidDataException

Archiv je zkorumpován.

Extract(Stream)

Odstraní vstup do poskytnutého toku.

public void Extract(Stream destination)

Parameters

destination Stream

Destinace stream. musí být psateln.

Examples

Vložte záznam z archivu xar.

using (var archive = new XarArchive("archive.xar"))
{
    ((XarFileEntry)archive.Entries[0]).Extract(httpResponseStream);
}

Exceptions

ArgumentException

destination’ does not support writing.

InvalidDataException

Archiv je zkorumpován.

Open()

Otevře vstup pro extrakci a poskytuje tok s obsahem vstupu.

public Stream Open()

Returns

Stream

Průtok, který představuje obsah vstupu.

Examples

Použit:Stream decompressed = entry.Open();

.NET 4.0 a vyšší - použijte metodu Stream.CopyTo:decompressed.CopyTo(httpResponse.OutputStream)

.NET 3.5 a předtím - manuálně kopírovat bajty:

byte[] buffer = new byte[8192];
int bytesRead;
while (0 < (bytesRead = decompressed.Read(buffer, 0, buffer.Length)))
 fileStream.Write(buffer, 0, bytesRead);
```</p>

#### Remarks

Read from the stream to get the original content of a file. See examples section.

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

Raises when a portion of raw stream compressed.

```csharp
public event EventHandler<progresseventargs> CompressionProgressed

Typ události

EventHandler < ProgressEventArgs >

Examples

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

Remarks

Posílatel událostí je příklad Aspose.Zip.Xar.XarFileEntry.

 Čeština