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

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

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

FilePath.zip介绍

[英]Creates a zip file from this directory or a file and sends that to the given output stream.
[中]从该目录或文件创建zip文件,并将其发送到给定的输出流。

代码示例

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

/**
 * Creates a zip file from this directory or a file and sends that to the given output stream.
 */
public void zip(OutputStream os) throws IOException, InterruptedException {
  zip(os,(FileFilter)null);
}

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

/**
 * Creates a zip file from this directory or a file and sends that to the given output stream.
 *
 * @deprecated as of 1.315. Use {@link #zip(OutputStream)} that has more consistent name.
 */
@Deprecated
public void createZipArchive(OutputStream os) throws IOException, InterruptedException {
  zip(os);
}

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

public void zip(FilePath dst) throws IOException, InterruptedException {
  try (OutputStream os = dst.write()) {
    zip(os);
  }
}

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

/**
 * Creates a zip file from this directory or a file and sends that to the
 * given output stream.
 *
 * @deprecated as of 1.315. Use {@link #zip(OutputStream)} that has more
 * consistent name.
 */
public void createZipArchive(OutputStream os) throws IOException, InterruptedException {
  zip(os);
}

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

/**
 * Creates a zip file from this directory or a file and sends that to the given output stream.
 */
public void zip(OutputStream os) throws IOException, InterruptedException {
  zip(os,(FileFilter)null);
}

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

/**
 * Creates a zip file from this directory or a file and sends that to the given output stream.
 */
public void zip(OutputStream os) throws IOException, InterruptedException {
  zip(os,(FileFilter)null);
}

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

/**
 * Creates a zip file from this directory or a file and sends that to the given output stream.
 *
 * @deprecated as of 1.315. Use {@link #zip(OutputStream)} that has more consistent name.
 */
public void createZipArchive(OutputStream os) throws IOException, InterruptedException {
  zip(os);
}

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

/**
 * Creates a zip file from this directory or a file and sends that to the given output stream.
 */
public void zip(OutputStream os) throws IOException, InterruptedException {
  zip(os,(FileFilter)null);
}

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

/**
 * Creates a zip file from this directory or a file and sends that to the
 * given output stream.
 */
public void zip(OutputStream os) throws IOException, InterruptedException {
  zip(os, (FileFilter) null);
}

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

/**
 * Creates a zip file from this directory or a file and sends that to the given output stream.
 *
 * @deprecated as of 1.315. Use {@link #zip(OutputStream)} that has more consistent name.
 */
public void createZipArchive(OutputStream os) throws IOException, InterruptedException {
  zip(os);
}

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

/**
 * Creates a zip file from this directory or a file and sends that to the given output stream.
 */
public void zip(OutputStream os) throws IOException, InterruptedException {
  zip(os,(FileFilter)null);
}

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

/**
 * Creates a zip file from this directory or a file and sends that to the given output stream.
 *
 * @deprecated as of 1.315. Use {@link #zip(OutputStream)} that has more consistent name.
 */
public void createZipArchive(OutputStream os) throws IOException, InterruptedException {
  zip(os);
}

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

/**
 * Creates a zip file from this directory or a file and sends that to the given output stream.
 *
 * @deprecated as of 1.315. Use {@link #zip(OutputStream)} that has more consistent name.
 */
@Deprecated
public void createZipArchive(OutputStream os) throws IOException, InterruptedException {
  zip(os);
}

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

public void zip(FilePath dst) throws IOException, InterruptedException {
  try (OutputStream os = dst.write()) {
    zip(os);
  }
}

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

/**
 * Creates a tar ball.
 */
public WorkspaceSnapshot snapshot(AbstractBuild<?, ?> build, FilePath ws, String glob, TaskListener listener) throws IOException, InterruptedException {
  File wss = new File(build.getRootDir(),"workspace.zip");
  OutputStream os = new BufferedOutputStream(new FileOutputStream(wss));
  try {
    ws.zip(os,glob);
  } finally {
    os.close();
  }
  return new WorkspaceSnapshotImpl();
}

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

/**
 * Creates a tar ball.
 */
public WorkspaceSnapshot snapshot(AbstractBuild<?, ?> build, FilePath ws, String glob, TaskListener listener) throws IOException, InterruptedException {
  File wss = new File(build.getRootDir(),"workspace.zip");
  OutputStream os = new BufferedOutputStream(new FileOutputStream(wss));
  try {
    ws.zip(os,glob);
  } finally {
    os.close();
  }
  return new WorkspaceSnapshotImpl();
}

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

/**
 * Creates a tar ball.
 */
public WorkspaceSnapshot snapshot(AbstractBuild<?, ?> build, FilePath ws, String glob, TaskListener listener) throws IOException, InterruptedException {
  File wss = new File(build.getRootDir(),"workspace.zip");
  OutputStream os = new BufferedOutputStream(new FileOutputStream(wss));
  try {
    ws.zip(os,glob);
  } finally {
    os.close();
  }
  return new WorkspaceSnapshotImpl();
}

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

/**
 * Creates a tar ball.
 */
public WorkspaceSnapshot snapshot(AbstractBuild<?, ?> build, FilePath ws, String glob, TaskListener listener) throws IOException, InterruptedException {
  File wss = new File(build.getRootDir(), "workspace.zip");
  OutputStream os = new BufferedOutputStream(new FileOutputStream(wss));
  try {
    ws.zip(os, glob);
  } finally {
    os.close();
  }
  return new WorkspaceSnapshotImpl();
}

代码示例来源:origin: XT-i/aws-lambda-jenkins-plugin

private File getArtifactZip(FilePath artifactLocation) throws IOException, InterruptedException {
    File resultFile = File.createTempFile("awslambda-", ".zip");

    if (!artifactLocation.isDirectory()) {
      if(artifactLocation.exists()) {
        logger.log("Copying zip file");
        artifactLocation.copyTo(new FileOutputStream(resultFile));
      } else {
        throw new LambdaDeployException("Could not find zipfile or folder.");
      }
    } else {
      logger.log("Zipping folder ..., copying zip file");
      artifactLocation.zip(new FileOutputStream(resultFile), new DirScanner.Glob("**", null, false));
    }

    logger.log("File Name: %s%nAbsolute Path: %s%nFile Size: %d", resultFile.getName(), resultFile.getAbsolutePath(), resultFile.length());
    return resultFile;
  }
}

代码示例来源:origin: ingenieux/awseb-deployment-plugin

private File getLocalFileObject(FilePath rootFileObject) throws Exception {
    File resultFile = File.createTempFile("awseb-", ".zip");

    if (!rootFileObject.isDirectory()) {
      log("Root File Object is a file. We assume its a zip file, which is okay.");

      rootFileObject.copyTo(new FileOutputStream(resultFile));
    } else {
      log("Zipping contents of Root File Object (%s) into tmp file %s (includes=%s, excludes=%s)",
          rootFileObject.getName(), resultFile.getName(),
          getConfig().getIncludes(), getConfig().getExcludes());

      rootFileObject.zip(new FileOutputStream(resultFile),
          new DirScanner.Glob(getConfig().getIncludes(),
              getConfig().getExcludes()));
    }

    return resultFile;
  }
}

相关文章