Interface IArchiveExtractCallback

All Superinterfaces:
IProgress

public interface IArchiveExtractCallback extends IProgress
Main callback interface for extraction operations.

To provide a password for extracting encrypted files, additionally implement ICryptoGetTextPassword in your IArchiveExtractCallback implementation.

Since:
4.65-1
Author:
Boris Brodski
  • Method Details

    • getStream

      ISequentialOutStream getStream(int index, ExtractAskMode extractAskMode) throws SevenZipException
      Return sequential output stream for the file with index index.
      Parameters:
      index - index of the item to extract
      extractAskMode - the mode in which 7-Zip is processing this item; see ExtractAskMode
      Returns:
      an instance of ISequentialOutStream sequential out stream or null to skip the extraction of the current item (with index index) and proceed with the next one
      Throws:
      SevenZipException - in error case. If this method ends with an exception, the current operation will be reported to 7-Zip as failed. There is no guarantee that no further callback methods will be called. The first and last thrown exceptions will be saved and thrown later on from the originally called method such as IInArchive.extract() or SevenZip.openInArchive(). Up to four exceptions depending on the situation can be saved for further analysis. See SevenZipException and SevenZipException.printStackTraceExtended() for details.
    • prepareOperation

      void prepareOperation(ExtractAskMode extractAskMode) throws SevenZipException
      Prepare operation. The index of the current archive item can be taken from the last call of getStream(int, ExtractAskMode).
      Parameters:
      extractAskMode - the mode in which 7-Zip is processing this item; see ExtractAskMode
      Throws:
      SevenZipException - in error case. If this method ends with an exception, the current operation will be reported to 7-Zip as failed. There is no guarantee that no further callback methods will be called. The first and last thrown exceptions will be saved and thrown later on from the originally called method such as IInArchive.extract() or SevenZip.openInArchive(). Up to four exceptions depending on the situation can be saved for further analysis. See SevenZipException and SevenZipException.printStackTraceExtended() for details.
    • setOperationResult

      void setOperationResult(ExtractOperationResult extractOperationResult) throws SevenZipException
      Set result of extraction operation of the file with index index from last call of getStream(int, ExtractAskMode).
      Parameters:
      extractOperationResult - result of operation
      Throws:
      SevenZipException - in error case. If this method ends with an exception, the current operation will be reported to 7-Zip as failed. There is no guarantee that no further callback methods will be called. The first and last thrown exceptions will be saved and thrown later on from the originally called method such as IInArchive.extract() or SevenZip.openInArchive(). Up to four exceptions depending on the situation can be saved for further analysis. See SevenZipException and SevenZipException.printStackTraceExtended() for details.
    • reportExtractResult

      default void reportExtractResult(ReportExtractResultIndexType indexType, int index, ExtractOperationResult extractOperationResult) throws SevenZipException
      Report an extraction result. Newer 7-Zip engine versions call this method to report extraction errors as they occur.

      This callback corresponds to the IArchiveExtractCallbackMessage2 interface introduced in the 7-Zip engine v23. It allows the native 7-Zip engine to report extraction errors immediately when they occur, rather than waiting until setOperationResult(ExtractOperationResult) is called. The method has a default no-op implementation, so existing callbacks written for older engine versions continue to work unchanged.

      Parameters:
      indexType - type of index being reported (ReportExtractResultIndexType)
      index - the archive item index or block index, depending on indexType
      extractOperationResult - the extraction operation result (e.g., OK, DATAERROR, CRCERROR)
      Throws:
      SevenZipException - in error case. If this method ends with an exception, the current operation will be reported to 7-Zip as failed.
      Since:
      23.01-2.2