本文整理汇总了Java中SevenZip.Archive.SevenZipEntry.isDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java SevenZipEntry.isDirectory方法的具体用法?Java SevenZipEntry.isDirectory怎么用?Java SevenZipEntry.isDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SevenZip.Archive.SevenZipEntry
的用法示例。
在下文中一共展示了SevenZipEntry.isDirectory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GetStream
import SevenZip.Archive.SevenZipEntry; //导入方法依赖的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;
}
示例2: GetStream
import SevenZip.Archive.SevenZipEntry; //导入方法依赖的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;
}
示例3: GetStream
import SevenZip.Archive.SevenZipEntry; //导入方法依赖的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;
}