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


Java IInArchive类代码示例

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


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

示例1: WriteEmptyFiles

import SevenZip.Archive.IInArchive; //导入依赖的package包/类
int WriteEmptyFiles() throws java.io.IOException {
    for(;_currentIndex < _extractStatuses.size(); _currentIndex++) {
        int index = _startIndex + _currentIndex;
        FileItem fileInfo = _archiveDatabase.Files.get(index);
        if (!fileInfo.IsAnti && !fileInfo.IsDirectory && fileInfo.UnPackSize != 0)
            return HRESULT.S_OK;
        int res = OpenFile();
        if (res != HRESULT.S_OK) return res;
        
        res = _extractCallback.SetOperationResult(
                IInArchive.NExtract_NOperationResult_kOK);
        if (res != HRESULT.S_OK) return res;
        _outStreamWithHashSpec.ReleaseStream();
    }
    return HRESULT.S_OK;
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:17,代码来源:FolderOutStream.java

示例2: PrepareOperation

import SevenZip.Archive.IInArchive; //导入依赖的package包/类
public int PrepareOperation(int askExtractMode) {
    _extractMode = false;
    switch (askExtractMode) {
        case IInArchive.NExtract_NAskMode_kExtract:
            _extractMode = true;
    };
    switch (askExtractMode) {
        case IInArchive.NExtract_NAskMode_kExtract:
            PrintString("Extracting  ");
            break;
        case IInArchive.NExtract_NAskMode_kTest:
            PrintString("Testing     ");
            break;
        case IInArchive.NExtract_NAskMode_kSkip:
            PrintString("Skipping    ");
            break;
    };
    PrintString(_filePath);
    return HRESULT.S_OK;
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:21,代码来源:ArchiveExtractCallback.java

示例3: WriteEmptyFiles

import SevenZip.Archive.IInArchive; //导入依赖的package包/类
int WriteEmptyFiles() throws java.io.IOException {
    for(;_currentIndex < _extractStatuses.size(); _currentIndex++) {
        int index = _startIndex + _currentIndex;
        FileItem fileInfo = _archiveDatabase.Files.get(index);
        if (!fileInfo.IsAnti && !fileInfo.IsDirectory && fileInfo.UnPackSize != 0)
            return HRESULT.S_OK;
        int res = OpenFile(parent_dir);
        if (res != HRESULT.S_OK) return res;
        
        res = _extractCallback.SetOperationResult(
                IInArchive.NExtract_NOperationResult_kOK);
        if (res != HRESULT.S_OK) return res;
        _outStreamWithHashSpec.ReleaseStream();
    }
    return HRESULT.S_OK;
}
 
开发者ID:sialan-labs,项目名称:Meikade,代码行数:17,代码来源:FolderOutStream.java

示例4: OpenFile

import SevenZip.Archive.IInArchive; //导入依赖的package包/类
int OpenFile() throws java.io.IOException {
    int askMode;
    if(_extractStatuses.get(_currentIndex))
        askMode = _testMode ?
            IInArchive.NExtract_NAskMode_kTest :
            IInArchive.NExtract_NAskMode_kExtract;
    else
        askMode = IInArchive.NExtract_NAskMode_kSkip;
    
    
    int index = _startIndex + _currentIndex;
    
    // RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode));
    java.io.OutputStream [] realOutStream2 = new java.io.OutputStream[1]; // TBD
    int ret = _extractCallback.GetStream(_ref2Offset + index, realOutStream2, askMode);
    if (ret != HRESULT.S_OK) return ret;
     
    java.io.OutputStream realOutStream = realOutStream2[0];
    
    _outStreamWithHashSpec.SetStream(realOutStream);
    _outStreamWithHashSpec.Init();
    if (askMode == IInArchive.NExtract_NAskMode_kExtract &&
            (realOutStream == null)) {
        FileItem fileInfo = _archiveDatabase.Files.get(index);
        if (!fileInfo.IsAnti && !fileInfo.IsDirectory)
            askMode = IInArchive.NExtract_NAskMode_kSkip;
    }
    return _extractCallback.PrepareOperation(askMode);
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:30,代码来源:FolderOutStream.java

示例5: testOrExtract

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

示例6: SetOperationResult

import SevenZip.Archive.IInArchive; //导入依赖的package包/类
public int SetOperationResult(int operationResult) throws java.io.IOException {
    switch(operationResult) {
        case IInArchive.NExtract_NOperationResult_kOK:
            break;
        default:
        {
            NumErrors++;
            PrintString("     ");
            switch(operationResult) {
                case IInArchive.NExtract_NOperationResult_kUnSupportedMethod:
                    PrintString("Unsupported Method");
                    break;
                case IInArchive.NExtract_NOperationResult_kCRCError:
                    PrintString("CRC Failed");
                    break;
                case IInArchive.NExtract_NOperationResult_kDataError:
                    PrintString("Data Error");
                    break;
                default:
                    PrintString("Unknown Error");
            }
        }
    }
        /*
        if(_outFileStream != null && _processedFileInfo.UTCLastWriteTimeIsDefined)
            _outFileStreamSpec->File.SetLastWriteTime(&_processedFileInfo.UTCLastWriteTime);
         */
    if (_outFileStream != null) _outFileStream.close(); // _outFileStream.Release();
        /*
        if (_extractMode && _processedFileInfo.AttributesAreDefined)
            NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attributes);
         */
    PrintNewLine();
    return HRESULT.S_OK;
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:36,代码来源:ArchiveExtractCallback.java

示例7: OpenFile

import SevenZip.Archive.IInArchive; //导入依赖的package包/类
int OpenFile(java.io.File parent_dir) throws java.io.IOException {
    int askMode;
    if(_extractStatuses.get(_currentIndex))
        askMode = _testMode ?
            IInArchive.NExtract_NAskMode_kTest :
            IInArchive.NExtract_NAskMode_kExtract;
    else
        askMode = IInArchive.NExtract_NAskMode_kSkip;
    
    
    int index = _startIndex + _currentIndex;
    
    // RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode));
    java.io.OutputStream [] realOutStream2 = new java.io.OutputStream[1]; // TBD

    // Updated to pass parent_dir argument [GAB, OpenLogic 2013-10-28]
    int ret = _extractCallback.GetStream(_ref2Offset + index, realOutStream2, askMode, parent_dir);
    if (ret != HRESULT.S_OK) return ret;
     
    java.io.OutputStream realOutStream = realOutStream2[0];
    
    _outStreamWithHashSpec.SetStream(realOutStream);
    _outStreamWithHashSpec.Init();
    if (askMode == IInArchive.NExtract_NAskMode_kExtract &&
            (realOutStream == null)) {
        FileItem fileInfo = _archiveDatabase.Files.get(index);
        if (!fileInfo.IsAnti && !fileInfo.IsDirectory)
            askMode = IInArchive.NExtract_NAskMode_kSkip;
    }
    return _extractCallback.PrepareOperation(askMode);
}
 
开发者ID:sialan-labs,项目名称:Meikade,代码行数:32,代码来源:FolderOutStream.java

示例8: testOrExtract

import SevenZip.Archive.IInArchive; //导入依赖的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());
    }
}
 
开发者ID:sialan-labs,项目名称:Meikade,代码行数:35,代码来源:J7zip.java

示例9: listing

import SevenZip.Archive.IInArchive; //导入依赖的package包/类
static void listing(IInArchive archive,Vector<String> listOfNames,boolean techMode) {
    
    if (!techMode) {
        System.out.println("  Date   Time   Attr         Size   Compressed  Name");
        System.out.println("-------------- ----- ------------ ------------  ------------");
    }
    
    long size = 0;
    long packSize = 0;
    long nbFiles = 0;
    
    for(int i = 0; i < archive.size() ; i++) {
        SevenZipEntry item = archive.getEntry(i);
        
        DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT , DateFormat.SHORT );
        String str_tm = formatter.format(new java.util.Date(item.getTime()));
        
        if (listOfNames.contains(item.getName())) {
            if (techMode) {
                System.out.println("Path = " + item.getName());
                System.out.println("Size = " + item.getSize());
                System.out.println("Packed Size = " + item.getCompressedSize());
                System.out.println("Modified = " + str_tm);
                System.out.println("   Attributes : " + item.getAttributesString());
                long crc = item.getCrc();
                if (crc != -1)
                    System.out.println("CRC = " + Long.toHexString(crc).toUpperCase());
                else
                    System.out.println("CRC =");
                System.out.println("Method = " + item.getMethods() );
                System.out.println("" );
                
            } else {
                System.out.print(str_tm + " " + item.getAttributesString());
                
                System.out.print(String.format("%13d",item.getSize()));
                
                System.out.print(String.format("%13d",item.getCompressedSize()));
                
                System.out.println("  " + item.getName());
            }
            
            size += item.getSize();
            packSize += item.getCompressedSize();
            nbFiles ++;
        }
    }
    
    if (!techMode) {
        System.out.println("-------------- ----- ------------ ------------  ------------");
        System.out.print(String.format("                    %13d%13d %d files",size,packSize,nbFiles));
    }
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:54,代码来源:J7zip.java

示例10: 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

示例11: 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

示例12: GetStream

import SevenZip.Archive.IInArchive; //导入依赖的package包/类
public int GetStream(int index,
            java.io.OutputStream [] outStream,
            int askExtractMode) throws java.io.IOException {
        
        outStream[0] = null;
        
        SevenZipEntry item = _archiveHandler.getEntry(index);
        _filePath = item.getName();
        
        if (extractDir != null)
        {
        	_filePath = extractDir + _filePath;
        }
        
        //AppDeck appDeck = AppDeck.getInstance();
        //_filePath = appDeck.cacheDir + _filePath;
        
/*        Context context = getA
        File httpCacheDir = new File(context.getCacheDir(), "http");
        _filePath = httpCacheDir + _filePath;*/
        
        File file = new File(_filePath);
        
        switch (askExtractMode) {
            case IInArchive.NExtract_NAskMode_kTest:
                return HRESULT.S_OK;
                
            case IInArchive.NExtract_NAskMode_kExtract:
                
                try {
                    isDirectory = item.isDirectory();
                    
                    if (isDirectory) {
                        if (file.isDirectory()) {
                            return HRESULT.S_OK;
                        }
                        if (file.mkdirs())
                            return HRESULT.S_OK;
                        else
                            return HRESULT.S_FALSE;
                    }
                    
                    
                    File dirs = file.getParentFile();
                    if (dirs != null) {
                        if (!dirs.isDirectory())
                            if (!dirs.mkdirs())
                                return HRESULT.S_FALSE;
                    }
                    
                    long pos = item.getPosition();
                    if (pos == -1) {
                        file.delete();
                    }
                    
                    java.io.RandomAccessFile outStr = new java.io.RandomAccessFile(_filePath,"rw");
                    
                    if (pos != -1) {
                        outStr.seek(pos);
                    }
                    
                    outStream[0] = new OutputStream(outStr);
                } catch (java.io.IOException e) {
                    return HRESULT.S_FALSE;
                }
                
                return HRESULT.S_OK;
                
        }
        
        // other case : skip ...
        
        return HRESULT.S_OK;
        
    }
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:76,代码来源:ArchiveExtractCallback.java

示例13: Init

import SevenZip.Archive.IInArchive; //导入依赖的package包/类
public void Init(SevenZip.Archive.IInArchive archiveHandler) {
    NumErrors = 0;
    _archiveHandler = archiveHandler;
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:5,代码来源:ArchiveExtractCallback.java

示例14: 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

示例15: GetStream

import SevenZip.Archive.IInArchive; //导入依赖的package包/类
public int GetStream(int index,
        java.io.OutputStream [] outStream,
        int askExtractMode) throws java.io.IOException {
    
    outStream[0] = null;
    
    SevenZipEntry item = _archiveHandler.getEntry(index);
    _filePath = item.getName();
    
    _filePath = _outputPath + "/" + _filePath;
    
    File file = new File(_filePath);
    
    switch (askExtractMode) {
        case IInArchive.NExtract_NAskMode_kTest:
            return HRESULT.S_OK;
            
        case IInArchive.NExtract_NAskMode_kExtract:
            
            try {
                isDirectory = item.isDirectory();
                
                if (isDirectory) {
                    if (file.isDirectory()) {
                        return HRESULT.S_OK;
                    }
                    if (file.mkdirs())
                        return HRESULT.S_OK;
                    else
                        return HRESULT.S_FALSE;
                }
                
                
                File dirs = file.getParentFile();
                if (dirs != null) {
                    if (!dirs.isDirectory())
                        if (!dirs.mkdirs())
                            return HRESULT.S_FALSE;
                }
                
                long pos = item.getPosition();
                if (pos == -1) {
                    file.delete();
                }
                
                java.io.RandomAccessFile outStr = new java.io.RandomAccessFile(_filePath,"rw");
                
                if (pos != -1) {
                    outStr.seek(pos);
                }
                
                outStream[0] = new OutputStream(outStr);
            } catch (java.io.IOException e) {
                return HRESULT.S_FALSE;
            }
            
            return HRESULT.S_OK;
            
    }
    
    // other case : skip ...
    
    return HRESULT.S_OK;
    
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:66,代码来源:RemoteAppCache.java


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