本文整理了Java中org.fcrepo.utilities.Zip.unzip()
方法的一些代码示例,展示了Zip.unzip()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zip.unzip()
方法的具体详情如下:
包路径:org.fcrepo.utilities.Zip
类名称:Zip
方法名:unzip
[英]Unzips the InputStream to the given destination directory.
[中]将InputStream解压到给定的目标目录。
代码示例来源:origin: fcrepo3/fcrepo
public static void unzip(InputStream is, String destDir)
throws FileNotFoundException, IOException {
unzip(is, new File(destDir));
}
代码示例来源:origin: org.fcrepo/fcrepo-common
public static void unzip(InputStream is, String destDir)
throws FileNotFoundException, IOException {
unzip(is, new File(destDir));
}
代码示例来源:origin: fcrepo3/fcrepo
private File stage(InputStream inputStream) throws IOException {
File stagingDir = new File(installDir, "fedorawar");
stagingDir.mkdirs();
Zip.unzip(inputStream, stagingDir);
return stagingDir;
}
private File repackage(File stagingDir, File outputFile) throws IOException {
代码示例来源:origin: fcrepo3/fcrepo
/**
* Unpacks the contents of the FEDORA_HOME directory from the Distribution.
*
* @throws InstallationFailedException
*/
private void unpack() throws InstallationFailedException {
System.out.println("Preparing FEDORA_HOME...");
if (!_installDir.exists() && !_installDir.mkdirs()) {
throw new InstallationFailedException(
"Unable to create FEDORA_HOME: "
+ _installDir.getAbsolutePath());
}
if (!_installDir.isDirectory()) {
throw new InstallationFailedException(_installDir.getAbsolutePath()
+ " is not a directory");
}
try {
Zip.unzip(_dist.get(Distribution.FEDORA_HOME), _installDir);
setScriptsExecutable(new File(_installDir, "client"
+ File.separator + "bin"));
File serverDir = new File(_installDir, "server");
if (_clientOnlyInstall) {
FileUtils.delete(serverDir);
} else {
setScriptsExecutable(new File(serverDir, "bin"));
}
} catch (IOException e) {
throw new InstallationFailedException(e.getMessage(), e);
}
}
代码示例来源:origin: fcrepo3/fcrepo
@Override
protected void installTomcat() throws InstallationFailedException {
System.out.println("Installing Tomcat...");
try {
Zip.unzip(getDist().get(Distribution.TOMCAT), System
.getProperty("java.io.tmpdir"));
} catch (IOException e) {
throw new InstallationFailedException(e.getMessage(), e);
}
File f =
new File(System.getProperty("java.io.tmpdir"),
Distribution.TOMCAT_BASENAME);
if (!FileUtils.move(f, getTomcatHome())) {
throw new InstallationFailedException("Move to "
+ getTomcatHome().getAbsolutePath() + " failed.");
}
FedoraHome.setScriptsExecutable(new File(getTomcatHome(), "bin"));
}
代码示例来源:origin: fcrepo3/fcrepo
@Test
public void testUnzip() throws Exception {
FileInputStream fis = new FileInputStream(ZIP_FILE);
Zip.unzip(fis, TMP_DIR);
FileReader fr =
new FileReader(TMP_DIR + File.separator + "foo"
+ File.separator + "foo.txt");
BufferedReader buff = new BufferedReader(fr);
boolean eof = false;
while (!eof) {
String line = buff.readLine();
if (line == null) {
eof = true;
} else {
assertEquals("foo", line);
}
}
buff.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!