本文整理汇总了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();
}