当前位置: 首页>>代码示例>>Java>>正文


Java IInArchive.Open方法代码示例

本文整理汇总了Java中SevenZip.Archive.IInArchive.Open方法的典型用法代码示例。如果您正苦于以下问题:Java IInArchive.Open方法的具体用法?Java IInArchive.Open怎么用?Java IInArchive.Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SevenZip.Archive.IInArchive的用法示例。


在下文中一共展示了IInArchive.Open方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extract

import SevenZip.Archive.IInArchive; //导入方法依赖的package包/类
public static void extract(String filename, String path) throws Exception {
    System.out.println("\nJ7zip 4.43 ALPHA 2 (" + Runtime.getRuntime().availableProcessors() + " CPUs)");
    
    
    MyRandomAccessFile istream = new MyRandomAccessFile(filename,"r");
    
    IInArchive archive = new Handler();
    
    int ret = archive.Open( istream );
    
    if (ret != 0) {
        System.out.println("ERROR !");
        return ;
    }
    
    Vector<String> listOfNames = new Vector<String>();
    //listOfNames.add(path);
    
    testOrExtract(archive,listOfNames,IInArchive.NExtract_NAskMode_kExtract);
    
    archive.close();
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:23,代码来源:J7zip.java

示例2: mainold

import SevenZip.Archive.IInArchive; //导入方法依赖的package包/类
public static void mainold(String[] args) throws Exception {
    System.out.println("\nJ7zip 4.43 ALPHA 2 (" + Runtime.getRuntime().availableProcessors() + " CPUs)");
    
    if (args.length < 2) {
        PrintHelp();
        return ;
    }
    
    final int MODE_LISTING = 0;
    final int MODE_TESTING = 1;
    final int MODE_EXTRACT = 2;
    
    int mode = -1;
    
    Vector<String> listOfNames = new Vector<String>();
    for (int i = 2;i < args.length ; i++)
        listOfNames.add(args[i]);
    
    if (args[0].equals("l")) {
        mode = MODE_LISTING;
    } else if (args[0].equals("t")) {
        mode = MODE_TESTING;
    } else if (args[0].equals("x")) {
        mode = MODE_EXTRACT;
    } else {
        PrintHelp();
        return ;
    }
    
    String filename = args[1];
    
    MyRandomAccessFile istream = new MyRandomAccessFile(filename,"r");
    
    IInArchive archive = new Handler();
    
    int ret = archive.Open( istream );
    
    if (ret != 0) {
        System.out.println("ERROR !");
        return ;
    }
    
    switch(mode) {
        case MODE_LISTING:
            listing(archive,listOfNames,false);
            break;
        case MODE_TESTING:
            testOrExtract(archive,listOfNames,IInArchive.NExtract_NAskMode_kTest);
            break;
        case MODE_EXTRACT:
            testOrExtract(archive,listOfNames,IInArchive.NExtract_NAskMode_kExtract);
            break;
    }
    
    archive.close();
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:57,代码来源:J7zip.java

示例3: extractAppCache

import SevenZip.Archive.IInArchive; //导入方法依赖的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();
   }
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:70,代码来源:RemoteAppCache.java

示例4: main

import SevenZip.Archive.IInArchive; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  // Added parent_dir to store destination directory [GAB, OpenLogic 2013-10-28]
    String parent_dir;
    System.out.println("\nJ7zip 4.43 ALPHA 2 (" + Runtime.getRuntime().availableProcessors() + " CPUs)");
    
    if (args.length < 2) {
        PrintHelp();
        return ;
    }
    
    // if the user has passed in a destination directory where
    // the extracted file should be written, use that,
    // otherwise use the current working directory
    if (args.length == 3) {
        parent_dir = args[2];
    }
    else {
        parent_dir = System.getProperty("user.dir");
    }
    
    final int MODE_LISTING = 0;
    final int MODE_TESTING = 1;
    final int MODE_EXTRACT = 2;
    
    int mode = -1;
    
    // this was used to pick out specific files to compress or extract
    // I'm not using it for our extraction-only tool, but it was too much
    // of a pain to remove it everywheere so I'm leaving an empty list as
    // a placeholder.
    Vector<String> listOfNames = new Vector<String>();
    
    if (args[0].equals("l")) {
        mode = MODE_LISTING;
    } else if (args[0].equals("t")) {
        mode = MODE_TESTING;
    } else if (args[0].equals("x")) {
        mode = MODE_EXTRACT;
    } else {
        PrintHelp();
        return ;
    }
    
    String filename = args[1];
    
    MyRandomAccessFile istream = new MyRandomAccessFile(filename,"r");
    
    IInArchive archive = new Handler();
    
    int ret = archive.Open( istream );
    
    if (ret != 0) {
        // System.out.println("ERROR !");
        throw new Invalid7zArchiveException("Invalid 7z archive");
        // return ;
    }
    
    switch(mode) {
        case MODE_LISTING:
            listing(archive,listOfNames,false);
            break;
        case MODE_TESTING:
            // Updated to include parent_dir argument [GAB, OpenLogic 2013-10-28]
            testOrExtract(archive,listOfNames,IInArchive.NExtract_NAskMode_kTest, parent_dir);
            break;
        case MODE_EXTRACT:
            // Updated to include parent_dir argument [GAB, OpenLogic 2013-10-28]
            testOrExtract(archive,listOfNames,IInArchive.NExtract_NAskMode_kExtract, parent_dir);
            break;
    }
    
    archive.close();
}
 
开发者ID:sialan-labs,项目名称:Meikade,代码行数:74,代码来源:J7zip.java


注:本文中的SevenZip.Archive.IInArchive.Open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。