本文整理汇总了Java中SevenZip.Archive.IInArchive.NExtract_NAskMode_kExtract方法的典型用法代码示例。如果您正苦于以下问题:Java IInArchive.NExtract_NAskMode_kExtract方法的具体用法?Java IInArchive.NExtract_NAskMode_kExtract怎么用?Java IInArchive.NExtract_NAskMode_kExtract使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SevenZip.Archive.IInArchive
的用法示例。
在下文中一共展示了IInArchive.NExtract_NAskMode_kExtract方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: 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);
}
示例4: 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;
}
示例5: 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;
}
示例6: GetStream
import SevenZip.Archive.IInArchive; //导入方法依赖的package包/类
public int GetStream(int index,
java.io.OutputStream [] outStream,
// Updated to pass parent_dir argument [GAB, OpenLogic 2013-10-28]
int askExtractMode, java.io.File parent_dir) throws java.io.IOException {
outStream[0] = null;
SevenZipEntry item = _archiveHandler.getEntry(index);
_filePath = item.getName();
// Updated to create the extracted file under the parent_dir directory [GAB, OpenLogic 2013-10-28]
File file = new File(parent_dir, _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();
}
// Write the extracted contents to the file under the parent_dir directory [GAB, OpenLogic 2013-10-28]
java.io.RandomAccessFile outStr = new java.io.RandomAccessFile(file,"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;
}