ZstandardLoadOptions
Inheritance: java.lang.Object
public class ZstandardLoadOptions
Alternativ med vilka ZstandardArchive laddas från en komprimerad fil. Innehåller händelse som utlöses vid extrahering.
Konstruktörer
| Konstruktor | Beskrivning |
|---|---|
| ZstandardLoadOptions() |
Metoder
| Metod | Beskrivning |
|---|---|
| getExtractionProgressed() | 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. |
| setExtractionProgressed(Event<ProgressEventArgs> value) | Ställer in en händelse som utlöses när några byte har extraherats. |
ZstandardLoadOptions()
public ZstandardLoadOptions()
getExtractionProgressed()
public Event<ProgressEventArgs> getExtractionProgressed()
Hämtar en händelse som utlöses när några byte har extraherats.
long length = 10_000_000; ZStandardLoadOptions loadOptions = new ZStandardLoadOptions(); loadOptions.setExtractionProgressed((sender, args) -> { int percent = (int)((100 * args.getProceededBytes()) / length); }); ZstandardArchive archive = new ZstandardArchive(“archive.zst”, loadOptions);
Event sender is the [ZstandardArchive](../../com.aspose.zip/zstandardarchive) 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 Zstandard archive extraction after a certain time.
try (CancellationFlag cf = new CancellationFlag()) {
cf.cancelAfter(TimeUnit.SECONDS.toMillis(60));
ZstandardLoadOptions options = new ZstandardLoadOptions();
options.setCancellationFlag(cf);
try (ZstandardArchive a = new ZstandardArchive("big.zstd", options)) {
try {
a.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. |
### setExtractionProgressed(Event<ProgressEventArgs> value) {#setExtractionProgressed-com.aspose.zip.Event-com.aspose.zip.ProgressEventArgs--}
```
public void setExtractionProgressed(Event<ProgressEventArgs> value)
```
Ställer in en händelse som utlöses när några byte har extraherats.
```
long length = 10_000_000; ZStandardLoadOptions loadOptions = new ZStandardLoadOptions(); loadOptions.setExtractionProgressed((sender, args) -> { int percent = (int)((100 * args.getProceededBytes()) / length); }); ZstandardArchive archive = new ZstandardArchive(“archive.zst”, loadOptions);
Event sender is the [ZstandardArchive](../../com.aspose.zip/zstandardarchive) instance which extraction is progressed.
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | com.aspose.zip.Event<com.aspose.zip.ProgressEventArgs> | an event that is raised when some bytes have been extracted |