GzipLoadOptions

Inheritance: java.lang.Object

public class GzipLoadOptions

Options for loading GzipArchive.

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

Constructors

ConstructorDescription
GzipLoadOptions()

Methods

MethodDescription
getParseHeader()Gets the value indicating whether to parse stream header to figure out properties, including name.
setCancellationFlag(CancellationFlag value)Sets a cancellation flag used to cancel the extraction operation.
setParseHeader(boolean value)Sets the value indicating whether to parse stream header to figure out properties, including name.

GzipLoadOptions()

public GzipLoadOptions()

getParseHeader()

public final boolean getParseHeader()

Gets the value indicating whether to parse stream header to figure out properties, including name. Makes sense for seekable stream only.

Returns: boolean - the value indicating whether to parse stream header to figure out properties, including name.

setCancellationFlag(CancellationFlag value)

public void setCancellationFlag(CancellationFlag value)

Sets a cancellation flag used to cancel the extraction operation.

Cancel gzip archive extraction after a certain time.


     try (CancellationFlag cf = new CancellationFlag()) {
         cf.cancelAfter(TimeUnit.SECONDS.toMillis(60));
         GzipLoadOptions options = new GzipLoadOptions();
         options.setCancellationFlag(cf);
         try (GzipArchive a = new GzipArchive("big.gz", 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.

setParseHeader(boolean value)

public final void setParseHeader(boolean value)

Sets the value indicating whether to parse stream header to figure out properties, including name. Makes sense for seekable stream only.

Parameters:

ParameterTypeDescription
valuebooleanthe value indicating whether to parse stream header to figure out properties, including name.