gpt4 book ai didi

org.apache.tools.ant.taskdefs.Zip类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 05:20:49 26 4
gpt4 key购买 nike

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

Zip介绍

[英]Create a Zip file.
[中]创建一个Zip文件。

代码示例

代码示例来源:origin: spring-io/initializr

@RequestMapping("/starter.zip")
@ResponseBody
public ResponseEntity<byte[]> springZip(BasicProjectRequest basicRequest)
    throws IOException {
  ProjectRequest request = (ProjectRequest) basicRequest;
  File dir = this.projectGenerator.generateProjectStructure(request);
  File download = this.projectGenerator.createDistributionFile(dir, ".zip");
  String wrapperScript = getWrapperScript(request);
  new File(dir, wrapperScript).setExecutable(true);
  Zip zip = new Zip();
  zip.setProject(new Project());
  zip.setDefaultexcludes(false);
  ZipFileSet set = new ZipFileSet();
  set.setDir(dir);
  set.setFileMode("755");
  set.setIncludes(wrapperScript);
  set.setDefaultexcludes(false);
  zip.addFileset(set);
  set = new ZipFileSet();
  set.setDir(dir);
  set.setIncludes("**,");
  set.setExcludes(wrapperScript);
  set.setDefaultexcludes(false);
  zip.addFileset(set);
  zip.setDestFile(download.getCanonicalFile());
  zip.execute();
  return upload(download, dir, generateFileName(request, "zip"), "application/zip");
}

代码示例来源:origin: apache/ignite

/**
 * Sets base directory for the archive.
 *
 * @param baseDir Base archive directory to set.
 */
@Override public void setBasedir(File baseDir) {
  super.setBasedir(baseDir);
  this.baseDir = baseDir;
}

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

z.setProject(prj);
z.setTaskType("zip");
classesJar.getParentFile().mkdirs();
z.setDestFile(classesJar);
z.add(mapper);
z.execute();

代码示例来源:origin: org.ow2.jonas.autostart/builder

Zip zip = new Zip();
zip.setBasedir(new File(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_ROOT_FOLDER));
zip.setDestFile(new File(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_ROOT_ZIP_FILE));
zip.setUpdate(true);
zip.setProject(p);
try {
  zip.execute();
  this.jonasLocation.set(0, this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_ROOT_ZIP_FILE);
} catch (Exception e) {
  zip.setBasedir(new File(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_BASE_FOLDER));
  zip.setDestFile(new File(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_BASE_ZIP_FILE));
  zip.setUpdate(true);
  zip.setProject(p);
  try {
    zip.execute();
    this.jonasLocation.set(1, this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_BASE_ZIP_FILE);
  } catch (Exception e) {

代码示例来源:origin: stackoverflow.com

Zip task = new Zip();
task.init();
task.setDestFile(new File(zipFilePath));
ZipFileSet zipFileSet = new ZipFileSet();
zipFileSet.setPrefix("WEB-INF/lib");
zipFileSet.setDir(new File(libsToAddDir));
task.addFileset(zipFileSet);
task.setUpdate(true);
task.setProject(p);
task.init();
target.addTask(task);
target.setProject(p);

代码示例来源:origin: ldcsaa/JessMA

/** 获取压缩任务对象 */
@Override
protected Task getTask()
{
  Project project    = new Project();
  Zip zip            = new Zip();
  FileSet src        = getSourceFileSet();
  
  src.setProject(project);
  zip.setProject(project);
  zip.setDestFile(getTargetFile());
  zip.addFileset(src);
  
  if(encoding != null)
    zip.setEncoding(encoding);
  if(comment != null)
    zip.setComment(comment);
  
  return zip;
}

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

Zip rezip = new Zip();
rezip.setDestFile(outputFile);
rezip.setProject(new Project());
ZipFileSet z = new ZipFileSet();
z.setSrc(war);
rezip.addZipfileset(z);
  z.setFile(hpi.getFile());
  z.setFullpath("/WEB-INF/plugins/"+hpi.getArtifactId()+".hpi");
  rezip.addZipfileset(z);
rezip.execute();
getLog().info("Generated "+outputFile);

代码示例来源:origin: stackoverflow.com

Project p = new Project();
p.init();
Zip zip = new Zip();
zip.setProject(p);
zip.setDestFile(zipFile); // a java.io.File for the zip you want to create
zip.setBasedir(new File("D:\\reports"));
zip.setIncludes("january/**");
zip.perform();

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

Zip zip = new Zip();
  zip.setDestFile(dest);
  ZipFileSet fs = new ZipFileSet();
  fs.setDir(source);
  fs.setPrefix(serverName);
  fs.setProject(project);
  zip.addFileset(fs);
  archiver = zip;
} else {

代码示例来源:origin: org.apache.ant/ant

/**
 * This is the name/location of where to
 * create the .zip file.
 * @param zipFile the path of the zipFile
 * @deprecated since 1.5.x.
 *             Use setDestFile(File) instead.
 * @ant.attribute ignore="true"
 */
@Deprecated
public void setZipfile(final File zipFile) {
  setDestFile(zipFile);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Adds a zipfileset to include in the META-INF directory.
 *
 * @param fs zipfileset to add
 */
public void addMetainf(ZipFileSet fs) {
  // We just set the prefix for this fileset, and pass it up.
  fs.setPrefix("META-INF/");
  super.addFileset(fs);
}

代码示例来源:origin: stackoverflow.com

import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.openqa.selenium.io.Zip;

public class tempUnit {

  public void test() {

    Zip zip = new Zip();
    try {
    zip.unzip(new File("D:\\TmpFS"), new File("D:\\TmpFS.zip"));
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

}

代码示例来源:origin: stackoverflow.com

public static processFile(String inputName, String outputName) {
 pipe(new FileInputStream(inputFile), new FileOutputStream(outputFile),
  new Zip(), new Sed(), new Unzip());
}

代码示例来源:origin: apache/ignite

super.execute();

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

/**
   * Copies a jar file from the master to slave.
   */
  private void copyJar(PrintStream log, FilePath dst, Class<?> representative, String seedName) throws IOException, InterruptedException {
    // in normal execution environment, the master should be loading 'representative' from this jar, so
    // in that way we can find it.
    File jar = Which.jarFile(representative);

    if(jar.isDirectory()) {
      // but during the development and unit test environment, we may be picking the class up from the classes dir
      Zip zip = new Zip();
      zip.setBasedir(jar);
      File t = File.createTempFile(seedName, "jar");
      t.delete();
      zip.setDestFile(t);
      zip.setProject(new Project());
      zip.execute();
      jar = t;
    }

    new FilePath(jar).copyTo(dst.child(seedName +".jar"));
    log.println("Copied "+seedName+".jar");
  }
}

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

z.setProject(prj);
z.setTaskType("zip");
classesJar.getParentFile().mkdirs();
z.setDestFile(classesJar);
z.add(mapper);
z.execute();

代码示例来源:origin: org.apache.ant/ant

/**
 * This is the name/location of where to
 * create the file.
 * @param file the path of the zipFile
 * @since Ant 1.5
 * @deprecated since 1.5.x.
 *             Use setDestFile(File) instead.
 * @ant.attribute ignore="true"
 */
@Deprecated
public void setFile(final File file) {
  setDestFile(file);
}

代码示例来源:origin: org.mule.tools/mule-tools-anttasks

/**
* add config files at top level
* @param fs the zip file set to add
*/
  public void addConfig(ZipFileSet fs)
  {
    super.addFileset(fs);
  }

代码示例来源:origin: org.ow2.jonas.autostart/builder

/**
 * Zip jonas-starter folder to jonas-starter.jar.
 */
public void zipStarter() {
  Project p = new Project();
  Zip zip = new Zip();
  zip.setBasedir(getStarterDefaultLocation());
  zip.setDestFile(new File(this.starterJarFileLocation.getAbsolutePath(), this.starterJarFileName));
  zip.setUpdate(true);
  zip.setProject(p);
  try {
    zip.execute();
    setStarterDefaultLocation(new File(this.starterJarFileLocation.getAbsolutePath(), this.starterJarFileName));
    renameStarterJarFile();
    this.output.write(this.starterJarFileName + " successfully created !");
    this.output.write("Location: " + this.starterDefaultLocation);
  } catch (Exception e) {
    this.output.write("Error in packaging jonas-starter : " + e.getMessage());
  }
}

代码示例来源:origin: stackoverflow.com

Project p = new Project();
p.init();
Zip zip = new Zip();
zip.setProject(p);
zip.setDestFile(new File(outputDir, "out.zip"));
FileSet fs = new FileSet();
fs.setProject(p);
fs.setDirectory(targetDir);
zip.addFileset(fs);
zip.perform();

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com