hudson.FilePath.unzipFrom()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中hudson.FilePath.unzipFrom()方法的一些代码示例,展示了FilePath.unzipFrom()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilePath.unzipFrom()方法的具体详情如下:
包路径:hudson.FilePath
类名称:FilePath
方法名:unzipFrom

FilePath.unzipFrom介绍

[英]Reads the given InputStream as a zip file and extracts it into this directory.
[中]将给定的InputStream作为zip文件读取,并将其解压缩到此目录中。

代码示例

代码示例来源:origin: jenkinsci/jenkins

try {
  if(archive.toExternalForm().endsWith(".zip"))
    unzipFrom(cis);
  else
    untarFrom(cis,GZIP);

代码示例来源:origin: org.eclipse.hudson/hudson-test-framework

@Override
  public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLogFile) throws IOException, InterruptedException {
    if (workspace.exists()) {
      listener.getLogger().println("Deleting existing workspace " + workspace.getRemote());
      workspace.deleteRecursive();
    }
    listener.getLogger().println("Staging " + zip);
    workspace.unzipFrom(zip.openStream());
    return true;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-framework

@Override
  public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLogFile) throws IOException, InterruptedException {
    if (workspace.exists()) {
      listener.getLogger().println("Deleting existing workspace " + workspace.getRemote());
      workspace.deleteRecursive();
    }
    listener.getLogger().println("Staging "+zip);
    workspace.unzipFrom(zip.openStream());
    return true;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-harness

@Override
  public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLogFile) throws IOException, InterruptedException {
    if (workspace.exists()) {
      listener.getLogger().println("Deleting existing workspace " + workspace.getRemote());
      workspace.deleteRecursive();
    }
    listener.getLogger().println("Staging "+zip);
    workspace.unzipFrom(zip.openStream());
    return true;
  }
}

代码示例来源:origin: jenkinsci/jenkins-test-harness

@Override
public boolean checkout(AbstractBuild<?,?> build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLogFile) throws IOException, InterruptedException {
  if (workspace.exists()) {
    listener.getLogger().println("Deleting existing workspace " + workspace.getRemote());
    workspace.deleteRecursive();
  }
  listener.getLogger().println("Staging first zip: " + firstZip);
  workspace.unzipFrom(firstZip.openStream());
  listener.getLogger().println("Staging second zip: " + secondZip);
  workspace.unzipFrom(secondZip.openStream());
  // Get list of files changed in secondZip.
  ZipInputStream zip = new ZipInputStream(secondZip.openStream());
  ZipEntry e;
  ExtractChangeLogParser.ExtractChangeLogEntry changeLog = new ExtractChangeLogParser.ExtractChangeLogEntry(secondZip.toString());
  try {
    while ((e = zip.getNextEntry()) != null) {
      if (!e.isDirectory())
        changeLog.addFile(new ExtractChangeLogParser.FileInZip(e.getName()));
    }
  }
  finally {
    zip.close();
  }
  saveToChangeLog(changeLogFile, changeLog);
  return true;
}

代码示例来源:origin: jenkinsci/jenkins-test-harness

@Override
  public boolean checkout(AbstractBuild<?,?> build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLogFile) throws IOException, InterruptedException {
    if (workspace.exists()) {
      listener.getLogger().println("Deleting existing workspace " + workspace.getRemote());
      workspace.deleteRecursive();
    }
    listener.getLogger().println("Staging "+zip);
    workspace.unzipFrom(zip.openStream());
    if (parentFolder != null) {
      FileUtils.copyDirectory( new File(workspace.getRemote() + "/" + parentFolder), new File( workspace.getRemote()));
    }
    return true;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-harness

@Override
public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLogFile) throws IOException, InterruptedException {
  if (workspace.exists()) {
    listener.getLogger().println("Deleting existing workspace " + workspace.getRemote());
    workspace.deleteRecursive();
  }
  listener.getLogger().println("Staging first zip: " + firstZip);
  workspace.unzipFrom(firstZip.openStream());
  listener.getLogger().println("Staging second zip: " + secondZip);
  workspace.unzipFrom(secondZip.openStream());
  // Get list of files changed in secondZip.
  ZipInputStream zip = new ZipInputStream(secondZip.openStream());
  ZipEntry e;
  ExtractChangeLogParser.ExtractChangeLogEntry changeLog = new ExtractChangeLogParser.ExtractChangeLogEntry(secondZip.toString());
  try {
    while ((e = zip.getNextEntry()) != null) {
      if (!e.isDirectory())
        changeLog.addFile(new ExtractChangeLogParser.FileInZip(e.getName()));
    }
  }
  finally {
    zip.close();
  }
  saveToChangeLog(changeLogFile, changeLog);
  return true;
}

代码示例来源:origin: org.eclipse.hudson/hudson-test-framework

@Override
public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLogFile) throws IOException, InterruptedException {
  if (workspace.exists()) {
    listener.getLogger().println("Deleting existing workspace " + workspace.getRemote());
    workspace.deleteRecursive();
  }
  listener.getLogger().println("Staging first zip: " + firstZip);
  workspace.unzipFrom(firstZip.openStream());
  listener.getLogger().println("Staging second zip: " + secondZip);
  workspace.unzipFrom(secondZip.openStream());
  // Get list of files changed in secondZip.
  ZipInputStream zip = new ZipInputStream(secondZip.openStream());
  ZipEntry e;
  ExtractChangeLogParser.ExtractChangeLogEntry changeLog = new ExtractChangeLogParser.ExtractChangeLogEntry(secondZip.toString());
  try {
    while ((e = zip.getNextEntry()) != null) {
      if (!e.isDirectory()) {
        changeLog.addFile(new ExtractChangeLogParser.FileInZip(e.getName()));
      }
    }
  } finally {
    zip.close();
  }
  saveToChangeLog(changeLogFile, changeLog);
  return true;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-framework

@Override
public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLogFile) throws IOException, InterruptedException {
  if (workspace.exists()) {
    listener.getLogger().println("Deleting existing workspace " + workspace.getRemote());
    workspace.deleteRecursive();
  }
  listener.getLogger().println("Staging first zip: " + firstZip);
  workspace.unzipFrom(firstZip.openStream());
  listener.getLogger().println("Staging second zip: " + secondZip);
  workspace.unzipFrom(secondZip.openStream());
  // Get list of files changed in secondZip.
  ZipInputStream zip = new ZipInputStream(secondZip.openStream());
  ZipEntry e;
  ExtractChangeLogParser.ExtractChangeLogEntry changeLog = new ExtractChangeLogParser.ExtractChangeLogEntry(secondZip.toString());
  try {
    while ((e = zip.getNextEntry()) != null) {
      if (!e.isDirectory())
        changeLog.addFile(new ExtractChangeLogParser.FileInZip(e.getName()));
    }
  }
  finally {
    zip.close();
  }
  saveToChangeLog(changeLogFile, changeLog);
  return true;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

try {
  if(archive.toExternalForm().endsWith(".zip"))
    unzipFrom(cis);
  else
    untarFrom(cis,GZIP);

代码示例来源:origin: hudson/hudson-2.x

unzipFrom(cis);
else
  untarFrom(cis,GZIP);

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

unzipFrom(cis);
else
  untarFrom(cis,GZIP);

代码示例来源:origin: jenkinsci/subversion-plugin

public static Proc runSvnServe(TemporaryFolder tmp, URL zip) throws Exception {
  File target = tmp.newFolder();
  try (InputStream is = zip.openStream()) {
    new FilePath(target).unzipFrom(is);
  }
  return runSvnServe(target);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

unzipFrom(cis);
else
  untarFrom(cis,GZIP);

代码示例来源:origin: org.eclipse.hudson/hudson-core

unzipFrom(cis);
} else {
  untarFrom(cis, GZIP);

相关文章