Class GzipLoadOptions


  • public class GzipLoadOptions
    extends Object

    Options for loading GzipArchive.

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

    • Constructor Detail

      • GzipLoadOptions

        public GzipLoadOptions()
    • Method Detail

      • setCancellationFlag

        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:
        value - a cancellation flag used to cancel the extraction operation.
      • 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:
        the value indicating whether to parse stream header to figure out properties, including name.
      • setParseHeader

        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:
        value - the value indicating whether to parse stream header to figure out properties, including name.