Class XarFileEntry

Class XarFileEntry

nazivni prostor: Aspose.Zip.Xar Sastav: Aspose.Zip.dll (25.5.0)

Predstavlja ulaz datoteke unutar arhiva xar.

public sealed class XarFileEntry : XarEntry, IArchiveFileEntry

Inheritance

object XarEntry XarFileEntry

Implements

IArchiveFileEntry

naslijeđeni članovi

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

Dostaje duljinu ulaza u bajtima.

public long Length { get; }

Vrijednost nekretnina

long

Methods

Extract(String)

Izvlači ulaz u sustav datoteke putem predviđenog puta.

public FileInfo Extract(string path)

Parameters

path string

Put do dosjea odredišta.Ako datoteka već postoji, bit će prepisana.

Returns

FileInfo

Informacije o sastavljenom datoteku.

Examples

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

Exceptions

ArgumentNullException

path’ is null.

SecurityException

Pozivač nema potrebnu dozvolu za pristup.

ArgumentException

path’ je prazan, sadrži samo bijele prostore, ili sadrži nevažeće znakove.

UnauthorizedAccessException

Pristup datoteci path" je odbijen.

PathTooLongException

Na primjer, na Windows platformama, staze moraju biti manje od 248 znakova, a imena datoteke moraju biti manje od 260 znakova.

NotSupportedException

File na path’ sadrži kolona (:) u sredini trake.

InvalidDataException

Arhiva je korumpirana.

Extract(Stream)

Izvlači ulaz u pruženi tok.

public void Extract(Stream destination)

Parameters

destination Stream

Destination stream. mora biti pismen.

Examples

Upišite ulaz iz arhiva xar.

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

Exceptions

ArgumentException

destination’ does not support writing.

InvalidDataException

Arhiva je korumpirana.

Open()

Otvara ulaz za ekstrakciju i pruža protok s ulaznim sadržajem.

public Stream Open()

Returns

Stream

Proljev koji predstavlja sadržaj ulaza.

Examples

Korištenje :Stream decompressed = entry.Open();

.NET 4.0 i viši - koristite metodu Stream.CopyTo:decompressed.CopyTo(httpResponse.OutputStream)

.NET 3.5 i ranije - kopirajte bajte ručno:

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

Vrsta događaja

EventHandler < ProgressEventArgs >

Examples

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

Remarks

Poslanik događaja je primjer Aspose.Zip.Xar.XarFileEntry.

 Hrvatski