Class XarFileEntry
Il nome: Aspose.Zip.Xar Assemblea: Aspose.Zip.dll (25.5.0)
Represente l’ingresso del file all’interno dell’archivio xar.
public sealed class XarFileEntry : XarEntry, IArchiveFileEntry
Inheritance
object ← XarEntry ← XarFileEntry
Implements
I membri ereditari
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
Riceve la lunghezza dell’ingresso in byte.
public long Length { get; }
Valore di proprietà
Methods
Extract(String)
Elimina l’ingresso nel file system attraverso il percorso fornito.
public FileInfo Extract(string path)
Parameters
path
string
Il percorso verso il file di destinazione. se il file esiste già, sarà sovrappeso.
Returns
Il file info del file composito.
Examples
using (var archive = new XarArchive("archive.xar"))
{
((XarFileEntry)archive.Entries[0]).Extract("data.bin");
}
Exceptions
path’ is null.
Il chiamante non ha il permesso di accesso richiesto.
La path’ è vuota, contiene solo spazi bianchi, o contiene caratteri invalidi.
L’accesso al file path" è rifiutato.
La specifica path’, nome del file, o entrambi superano la lunghezza massima definita dal sistema. ad esempio, su piattaforme basate su Windows, i percorsi devono essere meno di 248 caratteri, e i nomi del file devono essere meno di 260 caratteri.
Il file in path’ contiene una colonna (:) nel mezzo della riga.
L’archivio è corrotto.
Extract(Stream)
Elimina l’ingresso nel flusso fornito.
public void Extract(Stream destination)
Parameters
destination
Stream
Destinazione Stream. deve essere scritta.
Examples
Inserisci l’ingresso dell’archivio xar.
using (var archive = new XarArchive("archive.xar"))
{
((XarFileEntry)archive.Entries[0]).Extract(httpResponseStream);
}
Exceptions
destination’ does not support writing.
L’archivio è corrotto.
Open()
Apri l’ingresso per l’estrazione e fornisce un flusso con contenuti di ingresso.
public Stream Open()
Returns
Il flusso che rappresenta il contenuto dell’ingresso.
Examples
Uso di:Stream decompressed = entry.Open();
.NET 4.0 e superiore - utilizza il metodo Stream.CopyTo:decompressed.CopyTo(httpResponse.OutputStream)
.NET 3.5 e prima - copiare manualmente i byti:
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
Tipo di evento
EventHandler di < ProgressEventArgs >
Examples
archive.Entries.First().CompressionProgressed += (s, e) => { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };
Remarks
Il messaggero di eventi è un esempio Aspose.Zip.Xar.XarFileEntry.