ZipFile.setPassword
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using net.lingala.zip4j.core.ZipFile.setPassword (Showing top 9 results out of 315)

  • Common ways to obtain ZipFile
private void myMethod () {
ZipFile z =
  • File zipFile;new ZipFile(zipFile)
  • String zipFile;new ZipFile(zipFile)
  • Smart code suggestions by Codota
}
origin: net.lingala.zip4j/zip4j

/**
 * Sets the password for the zip file.<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
 * @throws ZipException
 */
public void setPassword(String password) throws ZipException {
  if (!Zip4jUtil.isStringNotNullAndNotEmpty(password)) {
    throw new NullPointerException();
  }
  setPassword(password.toCharArray());
}
 
origin: com.github.axet/zip4j

/**
 * Sets the password for the zip file.<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
 * @throws ZipException
 */
public void setPassword(String password) throws ZipException {
  if (!Zip4jUtil.isStringNotNullAndNotEmpty(password)) {
    throw new NullPointerException();
  }
  setPassword(password.toCharArray());
}
 
origin: org.jboss.forge.addon/resources-impl

@Override
public ZipFileResource setPassword(char[] password)
{
 try
 {
   getZipFile().setPassword(password);
 }
 catch (ZipException e)
 {
   throw new ResourceException("Error while setting the zip password", e);
 }
 return this;
}
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: SpringCloud/spring-cloud-codegen

  throw new ZipException("Password can't be empty with encryption mode");
zFile.setPassword(password.toCharArray());
origin: Nepxion/Skeleton

  throw new ZipException("Password can't be empty with encryption mode");
zFile.setPassword(password.toCharArray());
origin: jclehner/rxdroid

  public boolean restore(String password)
  {
    if(!isValid())
      throw new IllegalStateException("Invalid backup file");
    synchronized(Database.LOCK_DATA)
    {
      try
      {
        if(password != null)
          mZip.setPassword(password);
        mZip.extractAll(RxDroid.getPackageInfo().applicationInfo.dataDir);
      }
      catch(ZipException e)
      {
        final String msg = e.getMessage();
        if(password != null && msg.toLowerCase(Locale.US).contains("password"))
          return false;
        throw new WrappedCheckedException(e);
      }
      Settings.init(true);
    }
    NotificationReceiver.rescheduleAlarmsAndUpdateNotification(false);
    return true;
  }
}
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);
  }
}
origin: MCMrARM/revolution-irc

zipFile.setPassword(password);
net.lingala.zip4j.coreZipFilesetPassword

Javadoc

Sets the password for the zip file.
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

Popular methods of ZipFile

  • <init>
    Creates a new Zip File Object with the input file. If the zip file does not exist, it is not created
  • extractAll
    Extracts all the files in the given zip file to the input destination path. If zip file does not exi
  • addFolder
    Internal method to add a folder to the zip file.
  • addFile
    Adds input source file to the zip file. If zip file does not exist, then this method creates a new z
  • isValidZipFile
    Checks to see if the input zip file is a valid zip file. This method will try to read zip headers. I
  • getFileHeaders
    Returns the list of file headers in the zip file. Throws an exception if the zip file does not exist
  • isEncrypted
    Checks to see if the zip file is encrypted
  • extractFile
    Extracts a specific file from the zip file to the destination path. If destination path is invalid,
  • addFiles
    Adds the list of input files to the zip file. If zip file does not exist, then this method creates a
  • addStream
    Creates a new entry in the zip file and adds the content of the inputstream to the zip file. ZipPara
  • getInputStream
    Returns an input stream for reading the contents of the Zip file corresponding to the input FileHead
  • removeFile
    Removes the file provided in the input file header from the zip file. If zip file is a split zip fil
  • getInputStream,
  • removeFile,
  • setFileNameCharset,
  • getComment,
  • getFileHeader,
  • checkZipModel,
  • createNewZipModel,
  • createZipFile,
  • createZipFileFromFolder

Popular in Java

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • findViewById (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)