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

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

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

ZipFile.isEncrypted介绍

[英]Checks to see if the zip file is encrypted
[中]检查zip文件是否加密

代码示例

代码示例来源:origin: org.jboss.forge.addon/resources-impl

@Override
public boolean isEncrypted()
{
 try
 {
   return getZipFile().isEncrypted();
 }
 catch (ZipException e)
 {
   throw new ResourceException("Error while checking if file is encrypted", e);
 }
}

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

public BackupFile(String path)
{
  mPath = path;
  try
  {
    mZip = new ZipFile(path);
    mIsEncrypted = mZip.isEncrypted();
    if(mZip.getComment() == null)
      return;
    mInfo = mZip.getComment().split(":");
  }
  catch(ZipException e)
  {
    Log.w(TAG, e);
    return;
  }
  if(mInfo.length < 2 || !mInfo[0].startsWith("rxdbak") || mInfo[0].equals("rxdbak"))
    return;
  mVersion = Integer.parseInt(mInfo[0].substring("rxdbak".length()));
  mTimestamp = new Date(Long.parseLong(mInfo[1]));
  if(mInfo.length >= 3)
    mDbVersion = Integer.parseInt(mInfo[2].substring("DBv".length()));
  else
    mDbVersion = -1;
}

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

/**
 * Extract.
 *
 * @param zipFile4j
 *            the zip file4j
 * @param destination
 *            the destination
 * @param password
 *            the password
 * @throws ZipException
 *             the zip exception
 */
public static void extract(final ZipFile zipFile4j, final File destination,
  final String password) throws ZipException
{
  if (zipFile4j.isEncrypted())
  {
    zipFile4j.setPassword(password);
  }
  zipFile4j.extractAll(destination.getAbsolutePath());
}

代码示例来源:origin: org.apache.apex/apex-engine

if (zipFile.isEncrypted()) {
 throw new ZipException("Encrypted conf package not supported yet");

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

if (zFile.isEncrypted()) {
  if (StringUtils.isEmpty(password)) {
    throw new ZipException("Password can't be empty with encryption mode");

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

if (zFile.isEncrypted()) {
  if (StringUtils.isEmpty(password)) {
    throw new ZipException("Password can't be empty with encryption mode");

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

/**
 * Decompress.
 *
 * @param sourceZipFilePath
 *            the source zip file path
 * @param extractedZipFilePath
 *            the extracted zip file path
 * @param password
 *            the password
 */
public void decompress(String sourceZipFilePath, String extractedZipFilePath, String password) {
  try {
    ZipFile zipFile = new ZipFile(sourceZipFilePath);
    if (zipFile.isEncrypted()) {
      zipFile.setPassword(password);
    }
    zipFile.extractAll(extractedZipFilePath);
  } catch (Exception e) {
    JKExceptionUtil.handle(e);
  }
}

相关文章