本文整理匯總了Java中SevenZip.Archive.IArchiveExtractCallback類的典型用法代碼示例。如果您正苦於以下問題:Java IArchiveExtractCallback類的具體用法?Java IArchiveExtractCallback怎麽用?Java IArchiveExtractCallback使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IArchiveExtractCallback類屬於SevenZip.Archive包,在下文中一共展示了IArchiveExtractCallback類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Init
import SevenZip.Archive.IArchiveExtractCallback; //導入依賴的package包/類
public int Init(
ArchiveDatabaseEx archiveDatabase,
int ref2Offset,
int startIndex,
BoolVector extractStatuses,
IArchiveExtractCallback extractCallback,
boolean testMode) throws java.io.IOException {
_archiveDatabase = archiveDatabase;
_ref2Offset = ref2Offset;
_startIndex = startIndex;
_extractStatuses = extractStatuses;
_extractCallback = extractCallback;
_testMode = testMode;
_currentIndex = 0;
_fileIsOpen = false;
return WriteEmptyFiles();
}
示例2: testOrExtract
import SevenZip.Archive.IArchiveExtractCallback; //導入依賴的package包/類
static void testOrExtract(IInArchive archive,Vector<String> listOfNames,int mode) throws Exception {
ArchiveExtractCallback extractCallbackSpec = new ArchiveExtractCallback();
IArchiveExtractCallback extractCallback = extractCallbackSpec;
extractCallbackSpec.Init(archive);
extractCallbackSpec.PasswordIsDefined = false;
try {
int len = 0;
int arrays [] = null;
if (listOfNames.size() >= 1) {
arrays = new int[listOfNames.size()];
for(int i = 0 ; i < archive.size() ; i++) {
if (listOfNames.contains(archive.getEntry(i).getName())) {
arrays[len++] = i;
}
}
}
int res;
if (len == 0) {
res = archive.Extract(null, -1, mode , extractCallback);
} else {
res = archive.Extract(arrays, len, mode, extractCallback);
}
if (res == HRESULT.S_OK) {
if (extractCallbackSpec.NumErrors == 0)
System.out.println("Ok Done");
else
System.out.println(" " + extractCallbackSpec.NumErrors + " errors");
} else {
System.out.println("ERROR !!");
}
} catch (java.io.IOException e) {
System.out.println("IO error : " + e.getLocalizedMessage());
}
}
示例3: testOrExtract
import SevenZip.Archive.IArchiveExtractCallback; //導入依賴的package包/類
static void testOrExtract(IInArchive archive,Vector<String> listOfNames,int mode, String parent_dir) throws Exception {
ArchiveExtractCallback extractCallbackSpec = new ArchiveExtractCallback();
IArchiveExtractCallback extractCallback = extractCallbackSpec;
extractCallbackSpec.Init(archive);
extractCallbackSpec.PasswordIsDefined = false;
try {
int len = 0;
int arrays [] = null;
int res;
if (len == 0) {
// Updated to pass parent_dir argument [GAB, OpenLogic 2013-10-28]
res = archive.Extract(null, -1, mode , extractCallback, parent_dir);
} else {
// Updated to pass parent_dir argument [GAB, OpenLogic 2013-10-28]
res = archive.Extract(arrays, len, mode, extractCallback, parent_dir);
}
if (res == HRESULT.S_OK) {
if (extractCallbackSpec.NumErrors == 0)
System.out.println("Ok Done");
else
System.out.println(" " + extractCallbackSpec.NumErrors + " errors");
} else {
System.out.println("ERROR !!");
throw new Invalid7zArchiveException("Invalid 7z archive");
}
} catch (java.io.IOException e) {
System.out.println("IO error : " + e.getLocalizedMessage());
}
}
示例4: extractAppCache
import SevenZip.Archive.IArchiveExtractCallback; //導入依賴的package包/類
public void extractAppCache(SevenZip.IInStream istream, String outputPath) throws IOException
{
// create outputPath if needed
File folder = new File(outputPath);
boolean success = true;
if(!folder.exists()){
success = folder.mkdirs();
}
if (!success){
Log.d(TAG,"Folder not created.");
}
else{
Log.d(TAG,"Folder created!");
}
//RemoteAppCacheRandomAccessFile istream = new RemoteAppCacheRandomAccessFile(inputFile,"r");
IInArchive archive = new Handler();
int ret = archive.Open( istream );
if (ret != 0) {
System.out.println("ERROR !");
return ;
}
//Vector<String> listOfNames = new Vector<String>();
RemoteAppCacheArchiveExtractCallback extractCallbackSpec = new RemoteAppCacheArchiveExtractCallback(outputPath);
IArchiveExtractCallback extractCallback = extractCallbackSpec;
extractCallbackSpec.Init(archive);
extractCallbackSpec.PasswordIsDefined = false;
try {
int len = 0;
int arrays [] = null;
/* if (listOfNames.size() >= 1) {
arrays = new int[listOfNames.size()];
for(int i = 0 ; i < archive.size() ; i++) {
if (listOfNames.contains(archive.getEntry(i).getName())) {
arrays[len++] = i;
}
}
}*/
int res;
//if (len == 0) {
res = archive.Extract(null, -1, IInArchive.NExtract_NAskMode_kExtract , extractCallback);
//} else {
// res = archive.Extract(arrays, len, mode, extractCallback);
//}
if (res == HRESULT.S_OK) {
if (extractCallbackSpec.NumErrors == 0)
System.out.println("Ok Done");
else
System.out.println(" " + extractCallbackSpec.NumErrors + " errors");
} else {
System.out.println("ERROR !!");
}
} catch (java.io.IOException e) {
System.out.println("IO error : " + e.getLocalizedMessage());
}
archive.close();
}