org.eclipse.equinox.internal.p2.core.helpers.FileUtils.zipDirectoryEntry()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(145)

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

FileUtils.zipDirectoryEntry介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.equinox.p2/core

private static void zipDir(ZipOutputStream output, File source, Set<File> exclusions, IPathComputer pathComputer, Set<IPath> directoryEntries) throws IOException {
  File[] files = source.listFiles();
  if (files.length == 0) {
    zipDirectoryEntry(output, pathComputer.computePath(source), source.lastModified(), directoryEntries);

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.p2.core

private static void zipDirectoryEntry(ZipOutputStream output, IPath entry, long time, Set<IPath> directoryEntries) throws IOException {
  entry = entry.addTrailingSeparator();
  if (!directoryEntries.contains(entry)) {
    //make sure parent entries are in the zip
    if (entry.segmentCount() > 1)
      zipDirectoryEntry(output, entry.removeLastSegments(1), time, directoryEntries);
    try {
      ZipEntry dirEntry = new ZipEntry(entry.toString());
      dirEntry.setTime(time);
      output.putNextEntry(dirEntry);
      directoryEntries.add(entry);
    } catch (ZipException ze) {
      //duplicate entries shouldn't happen because we checked the set
    } finally {
      try {
        output.closeEntry();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.core

private static void zipDir(ZipOutputStream output, File source, Set<File> exclusions, IPathComputer pathComputer, Set<IPath> directoryEntries) throws IOException {
  File[] files = source.listFiles();
  if (files.length == 0) {
    zipDirectoryEntry(output, pathComputer.computePath(source), source.lastModified(), directoryEntries);

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.p2.core

private static void zipDir(ZipOutputStream output, File source, Set<File> exclusions, IPathComputer pathComputer, Set<IPath> directoryEntries) throws IOException {
  File[] files = source.listFiles();
  if (files.length == 0) {
    zipDirectoryEntry(output, pathComputer.computePath(source), source.lastModified(), directoryEntries);

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.core

private static void zipDirectoryEntry(ZipOutputStream output, IPath entry, long time, Set<IPath> directoryEntries) throws IOException {
  entry = entry.addTrailingSeparator();
  if (!directoryEntries.contains(entry)) {
    //make sure parent entries are in the zip
    if (entry.segmentCount() > 1)
      zipDirectoryEntry(output, entry.removeLastSegments(1), time, directoryEntries);
    try {
      ZipEntry dirEntry = new ZipEntry(entry.toString());
      dirEntry.setTime(time);
      output.putNextEntry(dirEntry);
      directoryEntries.add(entry);
    } catch (ZipException ze) {
      //duplicate entries shouldn't happen because we checked the set
    } finally {
      try {
        output.closeEntry();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.p2.core

private static void zipDirectoryEntry(ZipOutputStream output, IPath entry, long time, Set<IPath> directoryEntries) throws IOException {
  entry = entry.addTrailingSeparator();
  if (!directoryEntries.contains(entry)) {
    //make sure parent entries are in the zip
    if (entry.segmentCount() > 1)
      zipDirectoryEntry(output, entry.removeLastSegments(1), time, directoryEntries);
    try {
      ZipEntry dirEntry = new ZipEntry(entry.toString());
      dirEntry.setTime(time);
      output.putNextEntry(dirEntry);
      directoryEntries.add(entry);
    } catch (ZipException ze) {
      //duplicate entries shouldn't happen because we checked the set
    } finally {
      try {
        output.closeEntry();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}

代码示例来源:origin: org.eclipse.equinox.p2/core

private static void zipDirectoryEntry(ZipOutputStream output, IPath entry, long time, Set<IPath> directoryEntries) throws IOException {
  entry = entry.addTrailingSeparator();
  if (!directoryEntries.contains(entry)) {
    //make sure parent entries are in the zip
    if (entry.segmentCount() > 1)
      zipDirectoryEntry(output, entry.removeLastSegments(1), time, directoryEntries);
    try {
      ZipEntry dirEntry = new ZipEntry(entry.toString());
      dirEntry.setTime(time);
      output.putNextEntry(dirEntry);
      directoryEntries.add(entry);
    } catch (ZipException ze) {
      //duplicate entries shouldn't happen because we checked the set
    } finally {
      try {
        output.closeEntry();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.p2.core

zipDirectoryEntry(output, entryPath.removeLastSegments(1), source.lastModified(), directoryEntries);
zipDirectoryEntry(output, new Path("META-INF"), source.lastModified(), directoryEntries); //$NON-NLS-1$

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.core

zipDirectoryEntry(output, entryPath.removeLastSegments(1), source.lastModified(), directoryEntries);
zipDirectoryEntry(output, new Path("META-INF"), source.lastModified(), directoryEntries); //$NON-NLS-1$

代码示例来源:origin: org.eclipse.equinox.p2/core

zipDirectoryEntry(output, entryPath.removeLastSegments(1), source.lastModified(), directoryEntries);
zipDirectoryEntry(output, new Path("META-INF"), source.lastModified(), directoryEntries); //$NON-NLS-1$

代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.p2.core

private static void zipDir(ZipOutputStream output, File source, Set<File> exclusions, IPathComputer pathComputer, Set<IPath> directoryEntries) throws IOException {
  File[] files = source.listFiles();
  if (files.length == 0) {
    zipDirectoryEntry(output, pathComputer.computePath(source), source.lastModified(), directoryEntries);
  }
  // Different OSs return files in a different order.  This affects the creation
  // the dynamic path computer.  To address this, we sort the files such that
  // those with deeper paths appear later, and files are always before directories
  // foo/bar.txt
  // foo/something/bar2.txt
  // foo/something/else/bar3.txt
  Arrays.sort(files, (arg0, arg1) -> {
    Path a = new Path(arg0.getAbsolutePath());
    Path b = new Path(arg1.getAbsolutePath());
    if (a.segmentCount() == b.segmentCount()) {
      if (arg0.isDirectory() && arg1.isFile())
        return 1;
      else if (arg0.isDirectory() && arg1.isDirectory())
        return 0;
      else if (arg0.isFile() && arg1.isDirectory())
        return -1;
      else
        return 0;
    }
    return a.segmentCount() - b.segmentCount();
  });
  for (int i = 0; i < files.length; i++)
    zip(output, files[i], exclusions, pathComputer, directoryEntries);
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.p2.core

zipDirectoryEntry(output, entryPath.removeLastSegments(1), source.lastModified(), directoryEntries);
zipDirectoryEntry(output, new Path("META-INF"), source.lastModified(), directoryEntries); //$NON-NLS-1$

相关文章