org.zeroturnaround.zip.ZipUtil.packEntries()方法的使用及代码示例

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

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

ZipUtil.packEntries介绍

[英]Compresses the given files into a ZIP file.

The ZIP file must not be a directory and its parent directory must exist.
[中]将给定文件压缩为ZIP文件。
ZIP文件不能是目录,其父目录必须存在。

代码示例

代码示例来源:origin: zeroturnaround/zt-zip

  1. /**
  2. * Compresses the given file into a ZIP file.
  3. * <p>
  4. * The ZIP file must not be a directory and its parent directory must exist.
  5. *
  6. * @param fileToPack
  7. * file that needs to be zipped.
  8. * @param destZipFile
  9. * ZIP file that will be created or overwritten.
  10. * @param mapper
  11. * call-back for renaming the entries.
  12. */
  13. public static void packEntry(File fileToPack, File destZipFile, NameMapper mapper) {
  14. packEntries(new File[] { fileToPack }, destZipFile, mapper);
  15. }

代码示例来源:origin: zeroturnaround/zt-zip

  1. /**
  2. * Compresses the given files into a ZIP file.
  3. * <p>
  4. * The ZIP file must not be a directory and its parent directory must exist.
  5. *
  6. * @param filesToPack
  7. * files that needs to be zipped.
  8. * @param destZipFile
  9. * ZIP file that will be created or overwritten.
  10. */
  11. public static void packEntries(File[] filesToPack, File destZipFile) {
  12. packEntries(filesToPack, destZipFile, IdentityNameMapper.INSTANCE);
  13. }

代码示例来源:origin: zeroturnaround/zt-zip

  1. /**
  2. * Compresses the given files into a ZIP file.
  3. * <p>
  4. * The ZIP file must not be a directory and its parent directory must exist.
  5. *
  6. * @param filesToPack
  7. * files that needs to be zipped.
  8. * @param destZipFile
  9. * ZIP file that will be created or overwritten.
  10. * @param mapper
  11. * call-back for renaming the entries.
  12. */
  13. public static void packEntries(File[] filesToPack, File destZipFile, NameMapper mapper) {
  14. packEntries(filesToPack, destZipFile, mapper, DEFAULT_COMPRESSION_LEVEL);
  15. }

代码示例来源:origin: zeroturnaround/zt-zip

  1. /**
  2. * Compresses the given files into a ZIP file.
  3. * <p>
  4. * The ZIP file must not be a directory and its parent directory must exist.
  5. *
  6. * @param filesToPack
  7. * files that needs to be zipped.
  8. * @param destZipFile
  9. * ZIP file that will be created or overwritten.
  10. * @param compressionLevel
  11. * ZIP file compression level (speed versus filesize), e.g. <code>Deflater.NO_COMPRESSION</code>, <code>Deflater.BEST_SPEED</code>, or
  12. * <code>Deflater.BEST_COMPRESSION</code>
  13. */
  14. public static void packEntries(File[] filesToPack, File destZipFile, int compressionLevel) {
  15. packEntries(filesToPack, destZipFile, IdentityNameMapper.INSTANCE, compressionLevel);
  16. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature
  2. public void __construct(File file, boolean create) throws FileNotFoundException {
  3. if (!file.isFile()) {
  4. if (create) {
  5. ZipUtil.packEntries(new File[0], file);
  6. } else {
  7. throw new FileNotFoundException(file.getPath() + " not found, use ZipFile::create() to create zip archive.");
  8. }
  9. }
  10. this.zipFile = file;
  11. }

代码示例来源:origin: org.zeroturnaround/zt-zip

  1. /**
  2. * Compresses the given files into a ZIP file.
  3. * <p>
  4. * The ZIP file must not be a directory and its parent directory must exist.
  5. *
  6. * @param filesToPack
  7. * files that needs to be zipped.
  8. * @param destZipFile
  9. * ZIP file that will be created or overwritten.
  10. */
  11. public static void packEntries(File[] filesToPack, File destZipFile) {
  12. packEntries(filesToPack, destZipFile, IdentityNameMapper.INSTANCE);
  13. }

代码示例来源:origin: org.zeroturnaround/zt-zip

  1. /**
  2. * Compresses the given file into a ZIP file.
  3. * <p>
  4. * The ZIP file must not be a directory and its parent directory must exist.
  5. *
  6. * @param fileToPack
  7. * file that needs to be zipped.
  8. * @param destZipFile
  9. * ZIP file that will be created or overwritten.
  10. * @param mapper
  11. * call-back for renaming the entries.
  12. */
  13. public static void packEntry(File fileToPack, File destZipFile, NameMapper mapper) {
  14. packEntries(new File[] { fileToPack }, destZipFile, mapper);
  15. }

代码示例来源:origin: org.zeroturnaround/zt-zip

  1. /**
  2. * Compresses the given files into a ZIP file.
  3. * <p>
  4. * The ZIP file must not be a directory and its parent directory must exist.
  5. *
  6. * @param filesToPack
  7. * files that needs to be zipped.
  8. * @param destZipFile
  9. * ZIP file that will be created or overwritten.
  10. * @param mapper
  11. * call-back for renaming the entries.
  12. */
  13. public static void packEntries(File[] filesToPack, File destZipFile, NameMapper mapper) {
  14. packEntries(filesToPack, destZipFile, mapper, DEFAULT_COMPRESSION_LEVEL);
  15. }

代码示例来源:origin: org.zeroturnaround/zt-zip

  1. /**
  2. * Compresses the given files into a ZIP file.
  3. * <p>
  4. * The ZIP file must not be a directory and its parent directory must exist.
  5. *
  6. * @param filesToPack
  7. * files that needs to be zipped.
  8. * @param destZipFile
  9. * ZIP file that will be created or overwritten.
  10. * @param compressionLevel
  11. * ZIP file compression level (speed versus filesize), e.g. <code>Deflater.NO_COMPRESSION</code>, <code>Deflater.BEST_SPEED</code>, or
  12. * <code>Deflater.BEST_COMPRESSION</code>
  13. */
  14. public static void packEntries(File[] filesToPack, File destZipFile, int compressionLevel) {
  15. packEntries(filesToPack, destZipFile, IdentityNameMapper.INSTANCE, compressionLevel);
  16. }

相关文章