gpt4 book ai didi

org.apache.tools.ant.taskdefs.Zip.()方法的使用及代码示例

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

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

Zip.<init>介绍

暂无

代码示例

代码示例来源: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: stackoverflow.com

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

代码示例来源: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: org.ow2.jonas.autostart/builder

Zip zip = new Zip();

代码示例来源: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: 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: stackoverflow.com

project.init();
Zip zip = new Zip();
zip.setDestFile(zipFile);
zip.setProject(project);

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

/**
 * Copies a jar file from the master to slave.
 */
static FilePath 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);
  FilePath copiedJar = dst.child(seedName + ".jar");
  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;
  } else if (copiedJar.exists() && copiedJar.digest().equals(Util.getDigestOf(jar))) {
    log.println(seedName + ".jar already up to date");
    return copiedJar;
  }
  // Theoretically could be a race condition on a multi-executor Windows slave; symptom would be an IOException during the build.
  // Could perhaps be solved by synchronizing on dst.getChannel() or similar.
  new FilePath(jar).copyTo(copiedJar);
  log.println("Copied " + seedName + ".jar");
  return copiedJar;
}

代码示例来源: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();

代码示例来源:origin: MarkGao11520/acmen-helper

/**
 * 执行压缩操作
 * @param srcPathName 需要被压缩的文件/文件夹
 * @param dest 生成的zip包的位置
 */
public static void doZipCompress(String srcPathName, String dest) {
  File srcdir = new File(srcPathName);
  if (!srcdir.exists()){
    throw new GlobalException(1 , srcPathName + "不存在" , null);
  }
  File zipFile = new File(dest);
  Project prj = new Project();
  Zip zip = new Zip();
  zip.setProject(prj);
  zip.setDestFile(zipFile);
  FileSet fileSet = new FileSet();
  fileSet.setProject(prj);
  fileSet.setDir(srcdir);
  //排除哪些文件或文件夹
  fileSet.setExcludes(".DS_Store");
  zip.addFileset(fileSet);
  zip.execute();
}

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

Zip rezip = new Zip();
rezip.setDestFile(outputFile);
rezip.setProject(new Project());

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

formExistingFolder = true;
Zip zip = new Zip();
zip.setBasedir(getJonasRoot());
zip.setDestFile(new File(this.workdirectory, JONAS_ROOT_ZIP_FILE));

代码示例来源: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: stackoverflow.com

Zip task = new Zip();
task.init();
task.setDestFile(new File(zipFilePath));

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

Zip zip = new Zip();
zip.setDestFile(dest);
ZipFileSet fs = new ZipFileSet();

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