Package net.sf.sevenzipjbinding
Interface IArchiveExtractCallback
- All Superinterfaces:
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 Summary
Modifier and TypeMethodDescriptiongetStream(int index, ExtractAskMode extractAskMode) Return sequential output stream for the file with indexindex.voidprepareOperation(ExtractAskMode extractAskMode) Prepare operation.default voidreportExtractResult(ReportExtractResultIndexType indexType, int index, ExtractOperationResult extractOperationResult) Report an extraction error that is not tied to a single item, for example a damaged solid block of a 7z or CAB archive.voidsetOperationResult(ExtractOperationResult extractOperationResult) Set result of extraction operation of the file with indexindexfrom last call ofgetStream(int, ExtractAskMode).Methods inherited from interface net.sf.sevenzipjbinding.IProgress
setCompleted, setTotal
-
Method Details
-
getStream
Return sequential output stream for the file with indexindex.- Parameters:
index- index of the item to extractextractAskMode- the mode in which 7-Zip is processing this item; seeExtractAskMode- Returns:
- an instance of
ISequentialOutStreamsequential out stream ornullto skip the extraction of the current item (with indexindex) 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 asIInArchive.extract()orSevenZip.openInArchive(). Up to four exceptions depending on the situation can be saved for further analysis. SeeSevenZipExceptionandSevenZipException.printStackTraceExtended()for details.
-
prepareOperation
Prepare operation. The index of the current archive item can be taken from the last call ofgetStream(int, ExtractAskMode).- Parameters:
extractAskMode- the mode in which 7-Zip is processing this item; seeExtractAskMode- 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 asIInArchive.extract()orSevenZip.openInArchive(). Up to four exceptions depending on the situation can be saved for further analysis. SeeSevenZipExceptionandSevenZipException.printStackTraceExtended()for details.
-
setOperationResult
Set result of extraction operation of the file with indexindexfrom last call ofgetStream(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 asIInArchive.extract()orSevenZip.openInArchive(). Up to four exceptions depending on the situation can be saved for further analysis. SeeSevenZipExceptionandSevenZipException.printStackTraceExtended()for details.
-
reportExtractResult
default void reportExtractResult(ReportExtractResultIndexType indexType, int index, ExtractOperationResult extractOperationResult) throws SevenZipException Report an extraction error that is not tied to a single item, for example a damaged solid block of a 7z or CAB archive. Per-item results still arrive throughsetOperationResult(ExtractOperationResult); this method is an additional report, not a replacement.This callback corresponds to the engine's
IArchiveExtractCallbackMessage2interface. The method has a default no-op implementation, so existing callbacks continue to work unchanged.- Parameters:
indexType- type of index being reported (ReportExtractResultIndexType)index- the archive item index or block index, depending on indexTypeextractOperationResult- 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
-