org.fcrepo.utilities.Zip.zip()方法的使用及代码示例

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

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

Zip.zip介绍

[英]Create a zip file.
[中]创建一个zip文件。

代码示例

代码示例来源:origin: org.fcrepo/fcrepo-common

/**
 * Create a zip file.
 * 
 * @param destination
 *        The zip file to create.
 * @param source
 *        The file or directory to be zipped.
 * @throws FileNotFoundException
 * @throws IOException
 */
public static void zip(File destination, File source)
    throws FileNotFoundException, IOException {
  zip(destination, new File[] {source});
}

代码示例来源:origin: fcrepo3/fcrepo

/**
 * Create a zip file.
 * 
 * @param destination
 *        The zip file to create.
 * @param source
 *        The file or directory to be zipped.
 * @throws FileNotFoundException
 * @throws IOException
 */
public static void zip(File destination, File source)
    throws FileNotFoundException, IOException {
  zip(destination, new File[] {source});
}

代码示例来源:origin: org.fcrepo/fcrepo-common

public static void zip(String destination, String source)
    throws FileNotFoundException, IOException {
  zip(new File(destination), new File(source));
}

代码示例来源:origin: fcrepo3/fcrepo

public static void zip(String destination, String source)
    throws FileNotFoundException, IOException {
  zip(new File(destination), new File(source));
}

代码示例来源:origin: fcrepo3/fcrepo

private File repackage(File stagingDir, File outputFile) throws IOException {
  Zip.zip(outputFile, stagingDir.listFiles());
  FileUtils.delete(stagingDir);
  return outputFile;
}
private void addLibrary(File stagingDir, String libraryPath,

代码示例来源:origin: fcrepo3/fcrepo

/**
 * Create a zip file.
 * 
 * @param destination
 *        The zip file to create.
 * @param source
 *        The File array to be zipped.
 * @throws FileNotFoundException
 * @throws IOException
 */
public static void zip(File destination, File[] source)
    throws FileNotFoundException, IOException {
  FileOutputStream dest = new FileOutputStream(destination);
  ZipOutputStream zout =
      new ZipOutputStream(new BufferedOutputStream(dest));
  for (File element : source) {
    zip(null, element, zout);
  }
  zout.close();
}

代码示例来源:origin: org.fcrepo/fcrepo-common

/**
 * Create a zip file.
 * 
 * @param destination
 *        The zip file to create.
 * @param source
 *        The File array to be zipped.
 * @throws FileNotFoundException
 * @throws IOException
 */
public static void zip(File destination, File[] source)
    throws FileNotFoundException, IOException {
  FileOutputStream dest = new FileOutputStream(destination);
  ZipOutputStream zout =
      new ZipOutputStream(new BufferedOutputStream(dest));
  for (File element : source) {
    zip(null, element, zout);
  }
  zout.close();
}

代码示例来源:origin: fcrepo3/fcrepo

File files[] = source.listFiles();
for (File element : files) {
  zip(entry.getName(), element, zout);

代码示例来源:origin: org.fcrepo/fcrepo-common

File files[] = source.listFiles();
for (File element : files) {
  zip(entry.getName(), element, zout);

代码示例来源:origin: fcrepo3/fcrepo

@Test
public void testZip() throws Exception {
  Zip.zip(ZIP_FILE, SRC_DIR.listFiles());
  ZipFile zf = new ZipFile(ZIP_FILE);
  try {
    assertEquals(5, zf.size());
  } finally {
    zf.close();
  }
}

相关文章