gpt4 book ai didi

net.lingala.zip4j.core.ZipFile.addFile()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 13:52:40 27 4
gpt4 key购买 nike

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

ZipFile.addFile介绍

[英]Adds input source file to the zip file. If zip file does not exist, then this method creates a new zip file. Parameters such as compression type, etc can be set in the input parameters.
[中]将输入源文件添加到zip文件。如果zip文件不存在,则此方法将创建一个新的zip文件。可以在输入参数中设置压缩类型等参数。

代码示例

代码示例来源:origin: de.alpharogroup/file-worker

/**
 * Adds the given file(s) to the given zip file.
 *
 * @param zipFile4j
 *            the zip file4j
 * @param parameters
 *            the parameters
 * @param toAdd
 *            the list with the files to add in the zip file
 * @throws ZipException
 *             the zip exception
 */
public static void zipFiles(final ZipFile zipFile4j, final ZipParameters parameters,
  final List<File> toAdd) throws ZipException
{
  for (final File element : toAdd)
  {
    zipFile4j.addFile(element, parameters);
  }
}

代码示例来源:origin: SpringCloud/spring-cloud-codegen

zipFile.addFile(srcFile, parameters);

代码示例来源:origin: io.macgyver/macgyver-core

} catch (Exception e) {
mj.addFile(f, zp);

代码示例来源:origin: Nepxion/Skeleton

zipFile.addFile(srcFile, parameters);

代码示例来源:origin: jclehner/rxdroid

zip.addFile(file, zp);

代码示例来源:origin: com.tomitribe.tribestream/tribestream-container

for (final File f : content.files) {
  zip.addFile(f, parameters);

代码示例来源:origin: MCMrARM/revolution-irc

zipFile.addFile(f, params);
    synchronized (ServerCertificateManager.get(sslCertsFile)) { // lock the helper to prevent any writes to the file
      params.setFileNameInZip(BACKUP_SERVER_CERTS_PREFIX + data.uuid + BACKUP_SERVER_CERTS_SUFFIX);
      zipFile.addFile(sslCertsFile, params);
zipFile.addFile(NotificationCountStorage.getFile(context), params);
NotificationCountStorage.getInstance(context).open();
for (ThemeInfo themeInfo : themeManager.getCustomThemes()) {
  params.setFileNameInZip(BACKUP_THEME_PREFIX + themeInfo.uuid + BACKUP_THEME_SUFFIX);
  zipFile.addFile(themeManager.getThemePath(themeInfo.uuid), params);

代码示例来源:origin: com.jalalkiswani/jk-util

/**
 * Compress.
 *
 * @param fileName
 *            the file name
 * @param compressedFileName
 *            the compressed file name
 * @param password
 *            the password
 */
public static void compress(String fileName, String compressedFileName, String password) {
  try {
    ZipParameters zipParameters = new ZipParameters();
    zipParameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
    zipParameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_ULTRA);
    if (password != null) {
      zipParameters.setEncryptFiles(true);
      zipParameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES);
      zipParameters.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256);
      zipParameters.setPassword(password);
    }
    String destinationZipFilePath = compressedFileName;
    ZipFile zipFile = new ZipFile(destinationZipFilePath);
    zipFile.addFile(new File(fileName), zipParameters);
  } catch (ZipException e) {
    JKExceptionUtil.handle(e);
  }
}

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