XarLoadOptions

Inheritance: java.lang.Object

public class XarLoadOptions

Alternativ med vilka XAR-arkivet laddas från en komprimerad fil.

Konstruktörer

KonstruktorBeskrivning
XarLoadOptions()

Metoder

MetodBeskrivning
getEntryExtractionProgressed()Hämtar en händelse som utlöses när några byte har extraherats.
setCancellationFlag(CancellationFlag value)Ställer in en avbrytningsflagga som används för att avbryta extraheringsoperationen.
setEntryExtractionProgressed(Event<ProgressEventArgs> value)Ställer in en händelse som utlöses när några byte har extraherats.

XarLoadOptions()

public XarLoadOptions()

getEntryExtractionProgressed()

public final Event<ProgressEventArgs> getEntryExtractionProgressed()

Hämtar en händelse som utlöses när några byte har extraherats.

XarLoadOptions loadOptions = new XarLoadOptions(); loadOptions.setEntryExtractionProgressed((sender, args) -> { int percent = (int)((100 * args.getProceededBytes()) / ((XarFileEntry)sender).getLength()); }); XarArchive archive = new XarArchive(“archive.xar”, loadOptions);


Event sender is the [XarFileEntry](../../com.aspose.zip/xarfileentry) instance which extraction is progressed.

**Returns:**
[Event](../../com.aspose.zip/event) - an event that is raised when some bytes have been extracted
### setCancellationFlag(CancellationFlag value) {#setCancellationFlag-com.aspose.zip.CancellationFlag-}

public void setCancellationFlag(CancellationFlag value)



Sets a cancellation flag used to cancel the extraction operation.

Cancel XAR archive extraction after a certain time.

     try (CancellationFlag cf = new CancellationFlag()) {
         cf.cancelAfter(TimeUnit.SECONDS.toMillis(60));
         XarLoadOptions options = new XarLoadOptions();
         options.setCancellationFlag(cf);
         try (XarArchive a = new XarArchive("big.xar", options)) {
             try {
                 ((XarFileEntry) a.getEntries().get(0)).extract("data.bin");
             } catch (OperationCanceledException e) {
                 System.out.println("Extraction was cancelled after 60 seconds");
             }
         }
     }
 
```

Avbrytning resulterar oftast i att vissa data inte extraheras.

**Parameters:**
| Parameter | Typ | Beskrivning |
| --- | --- | --- |
| value | [CancellationFlag](../../com.aspose.zip/cancellationflag) | en avbrytande flagga som används för att avbryta extraktionsoperationen. |

### setEntryExtractionProgressed(Event&lt;ProgressEventArgs&gt; value) {#setEntryExtractionProgressed-com.aspose.zip.Event-com.aspose.zip.ProgressEventArgs--}
```
public final void setEntryExtractionProgressed(Event<ProgressEventArgs> value)
```


Ställer in en händelse som utlöses när några byte har extraherats.

```

XarLoadOptions loadOptions = new XarLoadOptions(); loadOptions.setEntryExtractionProgressed((sender, args) -> { int percent = (int)((100 * args.getProceededBytes()) / ((XarFileEntry)sender).getLength()); }); XarArchive archive = new XarArchive(“archive.xar”, loadOptions);


Event sender is the [XarFileEntry](../../com.aspose.zip/xarfileentry) instance which extraction is progressed.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | com.aspose.zip.Event&lt;com.aspose.zip.ProgressEventArgs&gt; | an event that is raised when some bytes have been extracted |