Java 类org.reflections.vfs.ZipDir 实例源码

项目:reflections    文件:VfsTest.java   
@Test
  public void vfsFromDirWithinAJarUrl() throws MalformedURLException {
    URL directoryInJarUrl = ClasspathHelper.forClass(String.class);
      assertTrue(directoryInJarUrl.toString().startsWith("jar:file:"));
      assertTrue(directoryInJarUrl.toString().contains(".jar!"));

      String directoryInJarPath = directoryInJarUrl.toExternalForm().replaceFirst("jar:", "");
      int start = directoryInJarPath.indexOf(":") + 1;
int end = directoryInJarPath.indexOf(".jar!") + 4;
String expectedJarFile = directoryInJarPath.substring(start, end);

      Vfs.Dir dir = Vfs.fromURL(new URL(directoryInJarPath));

      assertEquals(ZipDir.class, dir.getClass());
      assertEquals(expectedJarFile, dir.getPath());
  }
项目:motech    文件:TmpDir.java   
public TmpDir(File tmpDirFile) throws IOException {
    this.tmpDirFile = tmpDirFile;
    this.zipDir = new ZipDir(new JarFile(tmpDirFile));
}