gpt4 book ai didi

com.blankj.util.ZipUtils.zipFile()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:25:15 29 4
gpt4 key购买 nike

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

ZipUtils.zipFile介绍

[英]Zip the file.
[中]压缩文件。

代码示例

代码示例来源:origin: Blankj/AndroidUtilCode

/**
 * Zip the file.
 *
 * @param srcFile The source of file.
 * @param zipFile The ZIP file.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFile(final File srcFile,
               final File zipFile)
    throws IOException {
  return zipFile(srcFile, zipFile, null);
}

代码示例来源:origin: Blankj/AndroidUtilCode

/**
 * Zip the file.
 *
 * @param srcFile The source of file.
 * @param zipFile The ZIP file.
 * @param comment The comment.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFile(final File srcFile,
               final File zipFile,
               final String comment)
    throws IOException {
  if (srcFile == null || zipFile == null) return false;
  ZipOutputStream zos = null;
  try {
    zos = new ZipOutputStream(new FileOutputStream(zipFile));
    return zipFile(srcFile, "", zos, comment);
  } finally {
    if (zos != null) {
      zos.close();
    }
  }
}

代码示例来源:origin: Blankj/AndroidUtilCode

/**
 * Zip the files.
 *
 * @param srcFiles The source of files.
 * @param zipFile  The ZIP file.
 * @param comment  The comment.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFiles(final Collection<File> srcFiles,
                final File zipFile,
                final String comment)
    throws IOException {
  if (srcFiles == null || zipFile == null) return false;
  ZipOutputStream zos = null;
  try {
    zos = new ZipOutputStream(new FileOutputStream(zipFile));
    for (File srcFile : srcFiles) {
      if (!zipFile(srcFile, "", zos, comment)) return false;
    }
    return true;
  } finally {
    if (zos != null) {
      zos.finish();
      zos.close();
    }
  }
}

代码示例来源:origin: Blankj/AndroidUtilCode

/**
 * Zip the file.
 *
 * @param srcFilePath The path of source file.
 * @param zipFilePath The path of ZIP file.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFile(final String srcFilePath,
               final String zipFilePath)
    throws IOException {
  return zipFile(getFileByPath(srcFilePath), getFileByPath(zipFilePath), null);
}

代码示例来源:origin: Blankj/AndroidUtilCode

/**
 * Zip the files.
 *
 * @param srcFilePaths The paths of source files.
 * @param zipFilePath  The path of ZIP file.
 * @param comment      The comment.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFiles(final Collection<String> srcFilePaths,
                final String zipFilePath,
                final String comment)
    throws IOException {
  if (srcFilePaths == null || zipFilePath == null) return false;
  ZipOutputStream zos = null;
  try {
    zos = new ZipOutputStream(new FileOutputStream(zipFilePath));
    for (String srcFile : srcFilePaths) {
      if (!zipFile(getFileByPath(srcFile), "", zos, comment)) return false;
    }
    return true;
  } finally {
    if (zos != null) {
      zos.finish();
      zos.close();
    }
  }
}

代码示例来源:origin: Blankj/AndroidUtilCode

/**
 * Zip the file.
 *
 * @param srcFilePath The path of source file.
 * @param zipFilePath The path of ZIP file.
 * @param comment     The comment.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFile(final String srcFilePath,
               final String zipFilePath,
               final String comment)
    throws IOException {
  return zipFile(getFileByPath(srcFilePath), getFileByPath(zipFilePath), comment);
}

代码示例来源:origin: Blankj/AndroidUtilCode

} else {
  for (File file : fileList) {
    if (!zipFile(file, rootPath, zos, comment)) return false;

代码示例来源:origin: gradle.plugin.com.blankj/bus-gradle-plugin

/**
 * Zip the file.
 *
 * @param srcFile The source of file.
 * @param zipFile The ZIP file.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFile(final File srcFile,
               final File zipFile)
    throws IOException {
  return zipFile(srcFile, zipFile, null);
}

代码示例来源:origin: gradle.plugin.com.blankj/bus-gradle-plugin

/**
 * Zip the file.
 *
 * @param srcFile The source of file.
 * @param zipFile The ZIP file.
 * @param comment The comment.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFile(final File srcFile,
               final File zipFile,
               final String comment)
    throws IOException {
  if (srcFile == null || zipFile == null) return false;
  ZipOutputStream zos = null;
  try {
    zos = new ZipOutputStream(new FileOutputStream(zipFile));
    return zipFile(srcFile, "", zos, comment);
  } finally {
    if (zos != null) {
      zos.close();
    }
  }
}

代码示例来源:origin: gradle.plugin.com.blankj/bus-gradle-plugin

/**
 * Zip the files.
 *
 * @param srcFiles The source of files.
 * @param zipFile  The ZIP file.
 * @param comment  The comment.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFiles(final Collection<File> srcFiles,
                final File zipFile,
                final String comment)
    throws IOException {
  if (srcFiles == null || zipFile == null) return false;
  ZipOutputStream zos = null;
  try {
    zos = new ZipOutputStream(new FileOutputStream(zipFile));
    for (File srcFile : srcFiles) {
      if (!zipFile(srcFile, "", zos, comment)) return false;
    }
    return true;
  } finally {
    if (zos != null) {
      zos.finish();
      zos.close();
    }
  }
}

代码示例来源:origin: gradle.plugin.com.blankj/bus-gradle-plugin

/**
 * Zip the file.
 *
 * @param srcFilePath The path of source file.
 * @param zipFilePath The path of ZIP file.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFile(final String srcFilePath,
               final String zipFilePath)
    throws IOException {
  return zipFile(getFileByPath(srcFilePath), getFileByPath(zipFilePath), null);
}

代码示例来源:origin: gradle.plugin.com.blankj/bus-gradle-plugin

/**
 * Zip the files.
 *
 * @param srcFilePaths The paths of source files.
 * @param zipFilePath  The path of ZIP file.
 * @param comment      The comment.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFiles(final Collection<String> srcFilePaths,
                final String zipFilePath,
                final String comment)
    throws IOException {
  if (srcFilePaths == null || zipFilePath == null) return false;
  ZipOutputStream zos = null;
  try {
    zos = new ZipOutputStream(new FileOutputStream(zipFilePath));
    for (String srcFile : srcFilePaths) {
      if (!zipFile(getFileByPath(srcFile), "", zos, comment)) return false;
    }
    return true;
  } finally {
    if (zos != null) {
      zos.finish();
      zos.close();
    }
  }
}

代码示例来源:origin: gradle.plugin.com.blankj/bus-gradle-plugin

/**
 * Zip the file.
 *
 * @param srcFilePath The path of source file.
 * @param zipFilePath The path of ZIP file.
 * @param comment     The comment.
 * @return {@code true}: success<br>{@code false}: fail
 * @throws IOException if an I/O error has occurred
 */
public static boolean zipFile(final String srcFilePath,
               final String zipFilePath,
               final String comment)
    throws IOException {
  return zipFile(getFileByPath(srcFilePath), getFileByPath(zipFilePath), comment);
}

代码示例来源:origin: gradle.plugin.com.blankj/bus-gradle-plugin

} else {
  for (File file : fileList) {
    if (!zipFile(file, rootPath, zos, comment)) return false;

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