Codota Logo
ZipUtil.pack
Code IndexAdd Codota to your IDE (free)

How to use
pack
method
in
org.zeroturnaround.zip.ZipUtil

Best Java code snippets using org.zeroturnaround.zip.ZipUtil.pack (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: zeroturnaround/zt-zip

/**
 * Compresses the given directory and all its sub-directories into a ZIP file.
 * <p>
 * The ZIP file must not be a directory and its parent directory must exist.
 * Will not include the root directory name in the archive.
 *
 * @param rootDir
 *          root directory.
 * @param zip
 *          ZIP file that will be created or overwritten.
 */
public static void pack(File rootDir, File zip) {
 pack(rootDir, zip, DEFAULT_COMPRESSION_LEVEL);
}
origin: zeroturnaround/zt-zip

/**
 * Compresses the given directory and all of its sub-directories into the passed in
 * stream. It is the responsibility of the caller to close the passed in
 * stream properly.
 *
 * @param sourceDir
 *          root directory.
 * @param os
 *          output stream (will be buffered in this method).
 *
 * @since 1.10
 */
public static void pack(File sourceDir, OutputStream os) {
 pack(sourceDir, os, IdentityNameMapper.INSTANCE, DEFAULT_COMPRESSION_LEVEL);
}
origin: zeroturnaround/zt-zip

/**
 * Compresses the given directory and all of its sub-directories into the passed in
 * stream. It is the responsibility of the caller to close the passed in
 * stream properly.
 *
 * @param sourceDir
 *          root directory.
 * @param os
 *          output stream (will be buffered in this method).
 * @param mapper
 *          call-back for renaming the entries.
 *
 * @since 1.10
 */
public static void pack(File sourceDir, OutputStream os, NameMapper mapper) {
 pack(sourceDir, os, mapper, DEFAULT_COMPRESSION_LEVEL);
}
origin: zeroturnaround/zt-zip

/**
 * Compresses the given directory and all of its sub-directories into the passed in
 * stream. It is the responsibility of the caller to close the passed in
 * stream properly.
 *
 * @param sourceDir
 *          root directory.
 * @param os
 *          output stream (will be buffered in this method).
 * @param compressionLevel
 *          compression level
 *
 * @since 1.10
 */
public static void pack(File sourceDir, OutputStream os, int compressionLevel) {
 pack(sourceDir, os, IdentityNameMapper.INSTANCE, compressionLevel);
}
origin: zeroturnaround/zt-zip

/**
 * Compresses the given directory and all its sub-directories into a ZIP file.
 * <p>
 * The ZIP file must not be a directory and its parent directory must exist.
 *
 * @param sourceDir
 *          root directory.
 * @param targetZip
 *          ZIP file that will be created or overwritten.
 * @param mapper
 *          call-back for renaming the entries.
 */
public static void pack(File sourceDir, File targetZip, NameMapper mapper) {
 pack(sourceDir, targetZip, mapper, DEFAULT_COMPRESSION_LEVEL);
}
origin: zeroturnaround/zt-zip

/**
 * Compresses the given directory and all its sub-directories into a ZIP file.
 * <p>
 * The ZIP file must not be a directory and its parent directory must exist.
 * Will not include the root directory name in the archive.
 *
 * @param rootDir
 *          root directory.
 * @param zip
 *          ZIP file that will be created or overwritten.
 * @param compressionLevel
 *          compression level
 */
public static void pack(File rootDir, File zip, int compressionLevel) {
 pack(rootDir, zip, IdentityNameMapper.INSTANCE, compressionLevel);
}
origin: zeroturnaround/zt-zip

/**
 * Compresses the given directory and all its sub-directories into a ZIP file.
 * <p>
 * The ZIP file must not be a directory and its parent directory must exist.
 * Will not include the root directory name in the archive.
 *
 * @param sourceDir
 *          root directory.
 * @param targetZipFile
 *          ZIP file that will be created or overwritten.
 * @param preserveRoot
 *          true if the resulted archive should have the top directory entry
 */
public static void pack(final File sourceDir, final File targetZipFile, final boolean preserveRoot) {
 if (preserveRoot) {
  final String parentName = sourceDir.getName();
  pack(sourceDir, targetZipFile, new NameMapper() {
   public String map(String name) {
    return parentName + PATH_SEPARATOR + name;
   }
  });
 }
 else {
  pack(sourceDir, targetZipFile);
 }
}
origin: zeroturnaround/zt-zip

/**
 * Compresses the given entries into an output stream.
 *
 * @param entries
 *          ZIP entries added.
 * @param os
 *          output stream for the new ZIP (does not have to be buffered)
 *
 * @since 1.9
 */
public static void pack(ZipEntrySource[] entries, OutputStream os) {
 if (log.isDebugEnabled()) {
  log.debug("Creating stream from {}.", Arrays.asList(entries));
 }
 pack(entries, os, false);
}
origin: zeroturnaround/zt-zip

/**
 * Compresses the given entries into a new ZIP file.
 *
 * @param entries
 *          ZIP entries added.
 * @param zip
 *          new ZIP file created.
 */
public static void pack(ZipEntrySource[] entries, File zip) {
 if (log.isDebugEnabled()) {
  log.debug("Creating '{}' from {}.", zip, Arrays.asList(entries));
 }
 OutputStream out = null;
 try {
  out = new BufferedOutputStream(new FileOutputStream(zip));
  pack(entries, out, true);
 }
 catch (IOException e) {
  throw ZipExceptionUtil.rethrow(e);
 }
 finally {
  IOUtils.closeQuietly(out);
 }
}
origin: libgdx/packr

PackrFileUtils.delete(jar);
ZipUtil.pack(jarDir, jar);
FileUtils.deleteDirectory(jarDir);
origin: jphp-group/jphp

@Signature
public void addDirectory(Environment env, File path, int compressLevel, @Nullable Invoker invoker) {
  ZipUtil.pack(path, zipFile, invokerToNameMapper(invoker), compressLevel);
}
origin: zeroturnaround/zt-zip

out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(targetZip)));
out.setLevel(compressionLevel);
pack(sourceDir, out, mapper, "", true);
origin: zeroturnaround/zt-zip

out = new ZipOutputStream(new BufferedOutputStream(os));
out.setLevel(compressionLevel);
pack(sourceDir, out, mapper, "", true);
origin: zeroturnaround/zt-zip

pack(file, out, mapper, path, false);
origin: libgdx/packr

PackrFileUtils.delete(file);
ZipUtil.pack(fileNoExt, file);
FileUtils.deleteDirectory(fileNoExt);
origin: zeroturnaround/zt-zip

/**
 * Compresses a given directory in its own location.
 * <p>
 * A ZIP file will be first created with a temporary name. After the
 * compressing the directory will be deleted and the ZIP file will be renamed
 * as the original directory.
 *
 * @param dir
 *          input directory as well as the target ZIP file.
 * @param compressionLevel
 *          compression level
 *
 * @see #pack(File, File)
 */
public static void unexplode(File dir, int compressionLevel) {
 try {
  // Find a new unique name is the same directory
  File zip = FileUtils.getTempFileFor(dir);
  // Pack it
  pack(dir, zip, compressionLevel);
  // Delete the directory
  FileUtils.deleteDirectory(dir);
  // Rename the archive
  FileUtils.moveFile(zip, dir);
 }
 catch (IOException e) {
  throw ZipExceptionUtil.rethrow(e);
 }
}
origin: io.github.aktoluna/slnarch-common

 public static void zipDirectory(File directoryPath, File outputPath, int compressLevel) {
  ZipUtil.pack(directoryPath, outputPath, compressLevel);
 }
}
origin: com.infotel.seleniumRobot/core

  public static void zipFolder(final File folder, final File destZipFile) {
    try {
      File tempZip = File.createTempFile(destZipFile.getName(), ".zip");
      tempZip.deleteOnExit();
      ZipUtil.pack(folder, tempZip);
      FileUtils.copyFile(tempZip, destZipFile);
    } catch (IOException e) {
      logger.error("cannot create zip file", e);
    }
    
  }
}
origin: Microsoft/azure-maven-plugins

  protected File getZipFile() {
    final File zipFile = new File(stagingDirectoryPath + ".zip");
    final File stagingDirectory = new File(stagingDirectoryPath);

    ZipUtil.pack(stagingDirectory, zipFile);
    ZipUtil.removeEntry(zipFile, LOCAL_SETTINGS_FILE);
    return zipFile;
  }
}
origin: com.microsoft.azure/azure-maven-plugin-lib

  protected File getZipFile() {
    final File zipFile = new File(stagingDirectoryPath + ".zip");
    final File stagingDirectory = new File(stagingDirectoryPath);

    ZipUtil.pack(stagingDirectory, zipFile);
    ZipUtil.removeEntry(zipFile, LOCAL_SETTINGS_FILE);
    return zipFile;
  }
}
org.zeroturnaround.zipZipUtilpack

Javadoc

Compresses the given directory and all its sub-directories into a ZIP file.

The ZIP file must not be a directory and its parent directory must exist. Will not include the root directory name in the archive.

Popular methods of ZipUtil

  • unpack
    Unpacks a ZIP stream to the given directory. The output directory must not be a file.
  • unpackEntry
    Unpacks a single file from a ZIP archive to a file.
  • removeEntry
    Copies an existing ZIP file and removes entry with a given path.
  • iterate
    Reads the given ZIP stream and executes the given action for each given entry. For each given entry
  • containsEntry
    Checks if the ZIP file contains the given entry.
  • addOrReplaceEntries
    Copies an existing ZIP file and adds/replaces the given entries in it.
  • packEntries
    Compresses the given files into a ZIP file. The ZIP file must not be a directory and its parent dire
  • removeEntries
    Copies an existing ZIP file and removes entries with given paths.
  • repack
    Repacks a provided ZIP input stream into a ZIP file with a given compression level.
  • replaceEntry
    Copies an existing ZIP file and replaces a given entry in it.
  • unexplode
    Compresses a given directory in its own location. A ZIP file will be first created with a temporary
  • unwrap
    Unwraps a ZIP file to the given directory shaving of root dir. If there are multiple root dirs or en
  • unexplode,
  • unwrap,
  • addEntries,
  • addEntry,
  • archiveEqualsInternal,
  • checkDestinationFileForTraversal,
  • closeQuietly,
  • copyEntries,
  • doEntryEquals

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getApplicationContext (Context)
  • getExternalFilesDir (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Menu (java.awt)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • JCheckBox (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now