Tabnine Logo
ZipUtility.zipFiles
Code IndexAdd Tabnine to your IDE (free)

How to use
zipFiles
method
in
org.batfish.common.util.ZipUtility

Best Java code snippets using org.batfish.common.util.ZipUtility.zipFiles (Showing top 3 results out of 315)

origin: batfish/batfish

private boolean uploadTestrig(String fileOrDir, String testrigName, boolean autoAnalyze) {
 Path initialUploadTarget = Paths.get(fileOrDir);
 Path uploadTarget = initialUploadTarget;
 boolean createZip = Files.isDirectory(initialUploadTarget);
 if (createZip) {
  uploadTarget = CommonUtil.createTempFile("testrig", "zip");
  ZipUtility.zipFiles(initialUploadTarget.toAbsolutePath(), uploadTarget.toAbsolutePath());
 }
 try {
  boolean result =
    _workHelper.uploadSnapshot(
      _currContainerName, testrigName, uploadTarget.toString(), autoAnalyze);
  return result;
 } finally {
  if (createZip) {
   CommonUtil.delete(uploadTarget);
  }
 }
}
origin: batfish/batfish

@Nullable
@Deprecated
public Path getTestrigObject(String networkName, String testrigName, String objectName) {
 Path testrigDir = getdirSnapshot(networkName, testrigName);
 Path file = testrigDir.resolve(Paths.get(BfConsts.RELPATH_OUTPUT, objectName));
 /*
  * Check if we got an object name outside of the testrig folder, perhaps because of ".." in the
  * name; disallow it
  */
 if (!CommonUtil.getCanonicalPath(file).startsWith(CommonUtil.getCanonicalPath(testrigDir))) {
  throw new BatfishException("Illegal object name: '" + objectName + "'");
 }
 // Check in output then input directories for backward compatibility
 // Since inputs and outputs used to be stored together, in the testrig dir
 if (!file.toFile().exists()) {
  file = testrigDir.resolve(Paths.get(BfConsts.RELPATH_INPUT, objectName));
 }
 if (Files.isRegularFile(file)) {
  return file;
 } else if (Files.isDirectory(file)) {
  Path zipfile = Paths.get(file + ".zip");
  if (Files.exists(zipfile)) {
   CommonUtil.deleteIfExists(zipfile);
  }
  ZipUtility.zipFiles(file, zipfile);
  // TODO: delete the zipfile
  return zipfile;
 }
 return null;
}
origin: batfish/batfish

 /** Creates a snapshot zip with the specified config and returns the path to that zip */
 public static Path createSnapshotZip(
   String snapshot, String fileName, String content, TemporaryFolder folder) {
  Path tmpSnapshotSrcDir = createSnapshot(snapshot, fileName, content, folder);

  Path tmpSnapshotZip = tmpSnapshotSrcDir.resolve(String.format("%s.zip", snapshot));
  ZipUtility.zipFiles(tmpSnapshotSrcDir.resolve(snapshot), tmpSnapshotZip);
  return tmpSnapshotZip;
 }
}
org.batfish.common.utilZipUtilityzipFiles

Javadoc

Zip srcFolder and write to destZipFile

Popular methods of ZipUtility

  • addFileToZip
  • addFolderToZip
  • zipFilesToInputStream
    Zip srcFolder in memory and return input stream from which zip may be read.
  • zipFolder

Popular in Java

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
  • Menu (java.awt)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • JLabel (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now