gpt4 book ai didi

net.lingala.zip4j.model.ZipParameters.setPassword()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 17:34:40 26 4
gpt4 key购买 nike

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

ZipParameters.setPassword介绍

[英]Sets the password for the zip file or the file being added
Note: For security reasons, usage of this method is discouraged. Use setPassword(char[]) instead. As strings are immutable, they cannot be wiped out from memory explicitly after usage. Therefore, usage of Strings to store passwords is discouraged. More info here: http://docs.oracle.com/javase/1.5.0/docs/guide/security/jce/JCERefGuide.html#PBEEx
[中]设置zip文件或正在添加的文件的密码
注意:出于安全原因,不鼓励使用此方法。改用setPassword(char[])。由于字符串是不可变的,所以在使用后无法明确地从内存中删除它们。因此,不鼓励使用字符串存储密码。更多信息请点击此处:http://docs.oracle.com/javase/1.5.0/docs/guide/security/jce/JCERefGuide.html#PBEEx

代码示例

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

/**
 * Sets the password for the zip file or the file being added<br>
 * <b>Note</b>: For security reasons, usage of this method is discouraged. Use 
 * setPassword(char[]) instead. As strings are immutable, they cannot be wiped
 * out from memory explicitly after usage. Therefore, usage of Strings to store 
 * passwords is discouraged. More info here: 
 * http://docs.oracle.com/javase/1.5.0/docs/guide/security/jce/JCERefGuide.html#PBEEx
 * @param password
 */
public void setPassword(String password) {
  if (password == null) return;
  setPassword(password.toCharArray());
}

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

/**
 * Sets the password for the zip file or the file being added<br>
 * <b>Note</b>: For security reasons, usage of this method is discouraged. Use 
 * setPassword(char[]) instead. As strings are immutable, they cannot be wiped
 * out from memory explicitly after usage. Therefore, usage of Strings to store 
 * passwords is discouraged. More info here: 
 * http://docs.oracle.com/javase/1.5.0/docs/guide/security/jce/JCERefGuide.html#PBEEx
 * @param password
 */
public void setPassword(String password) {
  if (password == null) return;
  setPassword(password.toCharArray());
}

代码示例来源:origin: stackoverflow.com

public void zipFileWithPassword(String fileToZipPath,String password,String zippedFilePath) throws ZipException
{
  ZipFile zipFile=new ZipFile(zippedFilePath);
  ZipParameters parameters=new ZipParameters();
  parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
  parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
  parameters.setEncryptFiles(true);
  parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_STANDARD);
  parameters.setPassword(password);
  File fileToZip=new File(fileToZipPath);
  log(Severity.INFO,"Creating a ZIP file: %s",fileToZipPath);
  zipFile.addFile(fileToZip,parameters);
}

代码示例来源:origin: stackoverflow.com

zipParams.setEncryptFiles(true);
zipParams.setEncryptionMethod(Zip4jConstants.ENC_METHOD_STANDARD);
zipParams.setPassword(pass);
zipParams.setSourceExternalStream(true);
zipParams.setFileNameInZip(fileName);

代码示例来源:origin: stackoverflow.com

parameters.setPassword("howtodoinjava");

代码示例来源:origin: stackoverflow.com

parameters.setPassword(stringPassword);

代码示例来源:origin: stackoverflow.com

parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES);
parameters.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256);
parameters.setPassword(password);

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

zp.setPassword(password);
zp.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES);
zp.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256);

代码示例来源:origin: stackoverflow.com

zipParameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES);
zipParameters.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256);
zipParameters.setPassword(password);
String baseFileName = FilenameUtils.getBaseName(filePath);
String destinationZipFilePath = baseFileName + "." + EXTENSION;

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

parameters.setEncryptFiles(true);
parameters.setPassword(password.toCharArray());

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

parameters.setEncryptFiles(true);
parameters.setPassword(password.toCharArray());

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

parameters.setPassword(password);

代码示例来源: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);
  }
}

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

params.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES);
params.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256);
params.setPassword(password);

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