本文整理了Java中org.eclipse.equinox.internal.p2.core.helpers.FileUtils.untarFile()
方法的一些代码示例,展示了FileUtils.untarFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.untarFile()
方法的具体详情如下:
包路径:org.eclipse.equinox.internal.p2.core.helpers.FileUtils
类名称:FileUtils
方法名:untarFile
暂无
代码示例来源:origin: org.eclipse.equinox.p2/core
/**
* Unzip from a File to an output directory.
*/
public static File[] unzipFile(File zipFile, File outputDir) throws IOException {
// check to see if we have a tar'd and gz'd file
if (zipFile.getName().toLowerCase().endsWith(".tar.gz")) { //$NON-NLS-1$
try {
return untarFile(zipFile, outputDir);
} catch (TarException e) {
throw new IOException(e.getMessage());
}
}
InputStream in = new FileInputStream(zipFile);
try {
return unzipStream(in, zipFile.length(), outputDir, null, null);
} catch (IOException e) {
// add the file name to the message
throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
} finally {
in.close();
}
}
代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.p2.core
/**
* Unzip from a File to an output directory.
*/
public static File[] unzipFile(File zipFile, File outputDir) throws IOException {
// check to see if we have a tar'd and gz'd file
if (zipFile.getName().toLowerCase().endsWith(".tar.gz")) { //$NON-NLS-1$
try {
return untarFile(zipFile, outputDir);
} catch (TarException e) {
throw new IOException(e.getMessage());
}
}
InputStream in = new FileInputStream(zipFile);
try {
return unzipStream(in, zipFile.length(), outputDir, null, null);
} catch (IOException e) {
// add the file name to the message
throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
} finally {
in.close();
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.p2.core
/**
* Unzip from a File to an output directory.
*/
public static File[] unzipFile(File zipFile, File outputDir) throws IOException {
// check to see if we have a tar'd and gz'd file
if (zipFile.getName().toLowerCase().endsWith(".tar.gz")) { //$NON-NLS-1$
try {
return untarFile(zipFile, outputDir);
} catch (TarException e) {
IOException ioException = new IOException(e.getMessage());
ioException.initCause(e);
throw ioException;
}
}
try (InputStream in = new FileInputStream(zipFile)) {
return unzipStream(in, zipFile.length(), outputDir, null, null);
} catch (IOException e) {
// add the file name to the message
IOException ioException = new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
ioException.initCause(e);
throw ioException;
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.core
/**
* Unzip from a File to an output directory.
*/
public static File[] unzipFile(File zipFile, File outputDir) throws IOException {
// check to see if we have a tar'd and gz'd file
if (zipFile.getName().toLowerCase().endsWith(".tar.gz")) { //$NON-NLS-1$
try {
return untarFile(zipFile, outputDir);
} catch (TarException e) {
IOException ioException = new IOException(e.getMessage());
ioException.initCause(e);
throw ioException;
}
}
InputStream in = new FileInputStream(zipFile);
try {
return unzipStream(in, zipFile.length(), outputDir, null, null);
} catch (IOException e) {
// add the file name to the message
IOException ioException = new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
ioException.initCause(e);
throw ioException;
} finally {
in.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!