Class XarFileEntry

Class XarFileEntry

Именује се: Aspose.Zip.Xar Асамблеја: Aspose.Zip.dll (25.5.0)

Представља улаз датотеке у архиву xar.

public sealed class XarFileEntry : XarEntry, IArchiveFileEntry

Inheritance

object XarEntry XarFileEntry

Implements

IArchiveFileEntry

Наслеђени чланови

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

Добије дужину улаза у битовима.

public long Length { get; }

Вредност имовине

long

Methods

Extract(Стринг)

Екстрактира улаз у систем датотека путем којим је обезбеђен.

public FileInfo Extract(string path)

Parameters

path string

Пут до дестинације датотеке.Ако датотека већ постоји, она ће бити преписана.

Returns

FileInfo

Информације о датотеци састављеног датотеке.

Examples

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

Exceptions

ArgumentNullException

path’ is null.

SecurityException

Позивач нема захтеван дозволу за приступ.

ArgumentException

path’ је празан, садржи само беле просторе, или садржи неважеће знакове.

UnauthorizedAccessException

Приступ датотеци path’ је одбијен.

PathTooLongException

На пример, на платформима заснованим на Виндовсу, путеви морају бити мање од 248 знакова, а имена датотеке морају бити мање од 260 знакова.

NotSupportedException

Датотека у path’ садржи колону (:) у средини редове.

InvalidDataException

Архив је корумпиран.

Extract(Stream)

Екстрактира улаз у обезбеђени ток.

public void Extract(Stream destination)

Parameters

destination Stream

Destination stream. mora da bude pisano.

Examples

Истражите улаз из архива xar.

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

Exceptions

ArgumentException

destination’ does not support writing.

InvalidDataException

Архив је корумпиран.

Open()

Отворити улаз за екстракцију и пружити поток са улазним садржајем.

public Stream Open()

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 < (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

Тип догађаја

EventHandler < ProgressEventArgs >

Examples

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

Remarks

Посланик догађаја је Аспосе.Зип.Хар.ХарФилеЕнтри инстанција.

 Српски