XzLoadOptions

Inheritance: java.lang.Object

public class XzLoadOptions

Options for loading XzArchive.

In the .NET Framework 4.0 and above, can be used to cancel extraction.

Constructors

ConstructorDescription
XzLoadOptions()

Methods

MethodDescription
setCancellationFlag(CancellationFlag value)Sets a cancellation flag used to cancel the extraction operation.

XzLoadOptions()

public XzLoadOptions()

setCancellationFlag(CancellationFlag value)

public void setCancellationFlag(CancellationFlag value)

Sets a cancellation flag used to cancel the extraction operation.

Cancel lzip archive extraction after a certain time.


     try (CancellationFlag cf = new CancellationFlag()) {
         cf.cancelAfter(TimeUnit.SECONDS.toMillis(60));
         XzLoadOptions options = new XzLoadOptions();
         options.setCancellationFlag(cf);
         try (XzArchive a = new XzArchive("big.xz", options)) {
             try {
                 a.extract("data.bin");
             } catch (OperationCanceledException e) {
                 System.out.println("Extraction was cancelled after 60 seconds");
             }
         }
     }
 

Cancellation mostly results in some data not being extracted.

Parameters:

ParameterTypeDescription
valueCancellationFlaga cancellation flag used to cancel the extraction operation.