io.hawt.util.Zips类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(89)

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

Zips介绍

暂无

代码示例

代码示例来源:origin: hawtio/hawtio

/**
 * Creates a zip fie from the given source directory and output zip file name
 */
public static void createZipFile(Logger log, File sourceDir, File outputZipFile) throws IOException {
  FileFilter filter = null;
  createZipFile(log, sourceDir, outputZipFile, filter);
}

代码示例来源:origin: hawtio/hawtio

if (f.isDirectory()) {
  String prefix = path + f.getName() + "/";
  if (matches(filter, f)) {
    zos.putNextEntry(new ZipEntry(prefix));
    zipDirectory(log, f, zos, prefix, filter);
  if (matches(filter, f)) {
    FileInputStream fis = new FileInputStream(f);
    try {

代码示例来源:origin: hawtio/hawtio

public static void createZipFile(Logger log, File sourceDir, File outputZipFile, FileFilter filter) throws IOException {
  outputZipFile.getParentFile().mkdirs();
  OutputStream os = new FileOutputStream(outputZipFile);
  ZipOutputStream zos = new ZipOutputStream(os);
  try {
    //zos.setLevel(Deflater.DEFAULT_COMPRESSION);
    //zos.setLevel(Deflater.NO_COMPRESSION);
    String path = "";
    zipDirectory(log, sourceDir, zos, path, filter);
  } finally {
    closeQuietly(zos);
  }
}

代码示例来源:origin: io.hawt/hawtio-git

public static void doUploadFiles(WriteContext context, File folder, boolean unzip, List<File> uploadedFiles) throws IOException, GitAPIException {
    if (uploadedFiles != null) {
      for (File uploadedFile : uploadedFiles) {
        String name = uploadedFile.getName();
        if (unzip && name.endsWith(".zip")) {
          // lets unzip zip files into a folder

          File unzipDir = uploadedFile.getParentFile();

          ZipInputStream zis = new ZipInputStream(new FileInputStream(uploadedFile));
          try {
            ZipEntry entry = zis.getNextEntry();
            if (!entry.isDirectory()) {
              String folderName = name.substring(0, name.length() - 4);
              unzipDir = new File(uploadedFile.getParentFile(), folderName);
            }
          } finally {
            closeQuietly(zis);
          }

          Zips.unzip(new FileInputStream(uploadedFile), unzipDir);
          uploadedFile.delete();
          uploadedFile = unzipDir;
        }
        LOG.info("Adding to folder: " + folder + " file: " + uploadedFile + " to git");
        context.addFile(uploadedFile);
      }
    }
  }
}

代码示例来源:origin: io.hawt/hawtio-util

public static void createZipFile(Logger log, File sourceDir, File outputZipFile, FileFilter filter) throws IOException {
  outputZipFile.getParentFile().mkdirs();
  OutputStream os = new FileOutputStream(outputZipFile);
  ZipOutputStream zos = new ZipOutputStream(os);
  try {
    //zos.setLevel(Deflater.DEFAULT_COMPRESSION);
    //zos.setLevel(Deflater.NO_COMPRESSION);
    String path = "";
    zipDirectory(log, sourceDir, zos, path, filter);
  } finally {
    closeQuietly(zos);
  }
}

代码示例来源:origin: io.hawt/hawtio-git

Zips.unzip(inputStream, rootFolder);
} catch (Throwable e) {
  LOG.warn("Failed to unzip initial import URL: " + importURL + ". " + e, e);

代码示例来源:origin: io.hawt/hawtio-util

/**
 * Creates a zip fie from the given source directory and output zip file name
 */
public static void createZipFile(Logger log, File sourceDir, File outputZipFile) throws IOException {
  FileFilter filter = null;
  createZipFile(log, sourceDir, outputZipFile, filter);
}

代码示例来源:origin: io.hawt/hawtio-util

if (f.isDirectory()) {
  String prefix = path + f.getName() + "/";
  if (matches(filter, f)) {
    zos.putNextEntry(new ZipEntry(prefix));
    zipDirectory(log, f, zos, prefix, filter);
  if (matches(filter, f)) {
    FileInputStream fis = new FileInputStream(f);
    try {

代码示例来源:origin: io.fabric8.jube.images.fabric8/app-library

protected File createZip(File file) throws IOException {
  File answer = File.createTempFile(file.getName(), "zip");
  Zips.createZipFile(LOG, file, answer);
  return answer;
}

相关文章