org.apache.wicket.util.resource.ZipResourceStream.zipDir()方法的使用及代码示例

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

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

ZipResourceStream.zipDir介绍

[英]Recursive method for zipping the contents of a directory including nested directories.
[中]用于压缩包含嵌套目录的目录内容的递归方法。

代码示例

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Construct.
 * 
 * @param dir
 *            The directory where to look for files. The directory itself will not be included
 *            in the ZIP.
 * @param recursive
 *            If true, all subdirs will be zipped as well
 */
public ZipResourceStream(final File dir, final boolean recursive)
{
  if ((dir == null) || !dir.isDirectory())
  {
    throw new IllegalArgumentException("Not a directory: " + dir);
  }
  bytearray = new ByteArrayOutputStream();
  try
  {
    ZipOutputStream out = new ZipOutputStream(bytearray);
    zipDir(dir, out, "", recursive);
  }
  catch (Exception e)
  {
    throw new WicketRuntimeException(e);
  }
}

代码示例来源:origin: org.apache.wicket/wicket-util

try
  zipDir(dir, out, "", recursive);
} finally {
  out.close();

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

zipDir(f, out, path + f.getName() + "/", recursive);

代码示例来源:origin: org.apache.wicket/wicket-util

zipDir(f, out, path + f.getName() + "/", recursive);

相关文章