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

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

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

ZipFile.createZipFile介绍

[英]Creates a zip file and adds the source file to the zip file. If the zip file exists then this method throws an exception. Parameters such as compression type, etc can be set in the input parameters
[中]创建zip文件并将源文件添加到zip文件。如果zip文件存在,则此方法引发异常。可以在输入参数中设置压缩类型等参数

代码示例

代码示例来源:origin: com.github.axet/zip4j

/**
 * Creates a zip file and adds the list of source file(s) to the zip file. If the zip file
 * exists then this method throws an exception. Parameters such as compression type, etc
 * can be set in the input parameters
 * @param sourceFileList - File to be added to the zip file
 * @param parameters - parameters to create the zip file
 * @throws ZipException
 */
public void createZipFile(ArrayList sourceFileList, 
    ZipParameters parameters) throws ZipException {
  createZipFile(sourceFileList, parameters, false, -1);
}

代码示例来源:origin: net.lingala.zip4j/zip4j

/**
 * Creates a zip file and adds the list of source file(s) to the zip file. If the zip file
 * exists then this method throws an exception. Parameters such as compression type, etc
 * can be set in the input parameters
 * @param sourceFileList - File to be added to the zip file
 * @param parameters - parameters to create the zip file
 * @throws ZipException
 */
public void createZipFile(ArrayList sourceFileList, 
    ZipParameters parameters) throws ZipException {
  createZipFile(sourceFileList, parameters, false, -1);
}

代码示例来源:origin: com.github.axet/zip4j

/**
 * Creates a zip file and adds the source file to the zip file. If the zip file
 * exists then this method throws an exception. Parameters such as compression type, etc
 * can be set in the input parameters
 * @param sourceFile - File to be added to the zip file
 * @param parameters - parameters to create the zip file
 * @throws ZipException
 */
public void createZipFile(File sourceFile, ZipParameters parameters) throws ZipException {
  ArrayList sourceFileList = new ArrayList();
  sourceFileList.add(sourceFile);
  createZipFile(sourceFileList, parameters, false, -1);
}

代码示例来源:origin: net.lingala.zip4j/zip4j

/**
 * Creates a zip file and adds the source file to the zip file. If the zip file
 * exists then this method throws an exception. Parameters such as compression type, etc
 * can be set in the input parameters
 * @param sourceFile - File to be added to the zip file
 * @param parameters - parameters to create the zip file
 * @throws ZipException
 */
public void createZipFile(File sourceFile, ZipParameters parameters) throws ZipException {
  ArrayList sourceFileList = new ArrayList();
  sourceFileList.add(sourceFile);
  createZipFile(sourceFileList, parameters, false, -1);
}

代码示例来源:origin: com.github.axet/zip4j

/**
 * Creates a zip file and adds the source file to the zip file. If the zip file
 * exists then this method throws an exception. Parameters such as compression type, etc
 * can be set in the input parameters. While the method addFile/addFiles also creates the 
 * zip file if it does not exist, the main functionality of this method is to create a split
 * zip file. To create a split zip file, set the splitArchive parameter to true with a valid
 * splitLength. Split Length has to be more than 65536 bytes
 * @param sourceFile - File to be added to the zip file
 * @param parameters - parameters to create the zip file
 * @param splitArchive - if archive has to be split or not
 * @param splitLength - if archive has to be split, then length in bytes at which it has to be split
 * @throws ZipException
 */
public void createZipFile(File sourceFile, ZipParameters parameters, 
    boolean splitArchive, long splitLength) throws ZipException {
  
  ArrayList sourceFileList = new ArrayList();
  sourceFileList.add(sourceFile);
  createZipFile(sourceFileList, parameters, splitArchive, splitLength);
}

代码示例来源:origin: net.lingala.zip4j/zip4j

/**
 * Creates a zip file and adds the source file to the zip file. If the zip file
 * exists then this method throws an exception. Parameters such as compression type, etc
 * can be set in the input parameters. While the method addFile/addFiles also creates the 
 * zip file if it does not exist, the main functionality of this method is to create a split
 * zip file. To create a split zip file, set the splitArchive parameter to true with a valid
 * splitLength. Split Length has to be more than 65536 bytes
 * @param sourceFile - File to be added to the zip file
 * @param parameters - parameters to create the zip file
 * @param splitArchive - if archive has to be split or not
 * @param splitLength - if archive has to be split, then length in bytes at which it has to be split
 * @throws ZipException
 */
public void createZipFile(File sourceFile, ZipParameters parameters, 
    boolean splitArchive, long splitLength) throws ZipException {
  
  ArrayList sourceFileList = new ArrayList();
  sourceFileList.add(sourceFile);
  createZipFile(sourceFileList, parameters, splitArchive, splitLength);
}

相关文章