org.reflections.vfs.ZipDir类的使用及代码示例

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

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

ZipDir介绍

[英]an implementation of org.reflections.vfs.Vfs.Dir for java.util.zip.ZipFile
[中]org的一个实现。反思。vfs。Vfs。java的目录。util。拉链ZipFile

代码示例

代码示例来源:origin: ronmamo/reflections

public Dir createDir(URL url) throws Exception {
    try {
      URLConnection urlConnection = url.openConnection();
      if (urlConnection instanceof JarURLConnection) {
        urlConnection.setUseCaches(false);
        return new ZipDir(((JarURLConnection) urlConnection).getJarFile());
      }
    } catch (Throwable e) { /*fallback*/ }
    java.io.File file = getFile(url);
    if (file != null) {
      return new ZipDir(new JarFile(file));
    }
    return null;
  }
},

代码示例来源:origin: ronmamo/reflections

@Override
  public String toString() {
    return root.getPath() + "!" + java.io.File.separatorChar + entry.toString();
  }
}

代码示例来源:origin: ronmamo/reflections

public Dir createDir(final URL url) throws Exception {
    return new ZipDir(new JarFile(getFile(url)));
  }
},

代码示例来源:origin: org.reflections/reflections

@Override
  public String toString() {
    return root.getPath() + "!" + java.io.File.separatorChar + entry.toString();
  }
}

代码示例来源:origin: org.reflections/reflections

public Dir createDir(URL url) throws Exception {
    try {
      URLConnection urlConnection = url.openConnection();
      if (urlConnection instanceof JarURLConnection) {
          return new ZipDir(((JarURLConnection) urlConnection).getJarFile());
      }
    } catch (Throwable e) { /*fallback*/ }
    java.io.File file = getFile(url);
    if (file != null) {
      return new ZipDir(new JarFile(file));
    }
    return null;
  }
},

代码示例来源:origin: org.rapidpm/rapidpm-dependencies-core-reflections

@Override
 public String toString() {
  return root.getPath() + "!" + java.io.File.separatorChar + entry.toString();
 }
}

代码示例来源:origin: ronmamo/reflections

public Dir createDir(final URL url) {
  try {
    URL adaptedUrl = adaptURL(url);
    return new ZipDir(new JarFile(adaptedUrl.getFile()));
  } catch (Exception e) {
    try {
      return new ZipDir(new JarFile(url.getFile()));
    } catch (IOException e1) {
      if (Reflections.log != null) {
        Reflections.log.warn("Could not get URL", e);
        Reflections.log.warn("Could not get URL", e1);
      }
    }
  }
  return null;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections

@Override
  public String toString() {
    return root.getPath() + "!" + java.io.File.separatorChar + entry.toString();
  }
}

代码示例来源:origin: org.reflections/reflections

public Dir createDir(final URL url) throws Exception {
    return new ZipDir(new JarFile(getFile(url)));
  }
},

代码示例来源:origin: ai.h2o/reflections

@Override
  public String toString() {
    return root.getPath() + "!" + java.io.File.separatorChar + entry.toString();
  }
}

代码示例来源:origin: org.reflections/reflections

public Dir createDir(final URL url) {
  try {
    URL adaptedUrl = adaptURL(url);
    return new ZipDir(new JarFile(adaptedUrl.getFile()));
  } catch (Exception e) {
    try {
      return new ZipDir(new JarFile(url.getFile()));
    } catch (IOException e1) {
      if (Reflections.log != null) {
        Reflections.log.warn("Could not get URL", e);
        Reflections.log.warn("Could not get URL", e1);
      }
    }
  }
  return null;
}

代码示例来源:origin: ronmamo/reflections

public Vfs.Dir createDir(URL url) throws Exception {
    Object content = url.openConnection().getContent();
    Class<?> virtualFile = ClasspathHelper.contextClassLoader().loadClass("org.jboss.vfs.VirtualFile");
    java.io.File physicalFile = (java.io.File) virtualFile.getMethod("getPhysicalFile").invoke(content);
    String name = (String) virtualFile.getMethod("getName").invoke(content);
    java.io.File file = new java.io.File(physicalFile.getParentFile(), name);
    if (!file.exists() || !file.canRead()) file = physicalFile;
    return file.isDirectory() ? new SystemDir(file) : new ZipDir(new JarFile(file));
  }
},

代码示例来源:origin: org.reflections/reflections

public Vfs.Dir createDir(URL url) throws Exception {
    Object content = url.openConnection().getContent();
    Class<?> virtualFile = ClasspathHelper.contextClassLoader().loadClass("org.jboss.vfs.VirtualFile");
    java.io.File physicalFile = (java.io.File) virtualFile.getMethod("getPhysicalFile").invoke(content);
    String name = (String) virtualFile.getMethod("getName").invoke(content);
    java.io.File file = new java.io.File(physicalFile.getParentFile(), name);
    if (!file.exists() || !file.canRead()) file = physicalFile;
    return file.isDirectory() ? new SystemDir(file) : new ZipDir(new JarFile(file));
  }
},

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections

public Dir createDir(URL url) throws Exception {
    try {
      URLConnection urlConnection = url.openConnection();
      if (urlConnection instanceof JarURLConnection) {
          return new ZipDir(((JarURLConnection) urlConnection).getJarFile());
      }
    } catch (Throwable e) { /*fallback*/ }
    java.io.File file = getFile(url);
    if (file != null) {
      return new ZipDir(new JarFile(file));
    }
    return null;
  }
},

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections

public Vfs.Dir createDir(URL url) throws Exception {
    Object content = url.openConnection().getContent();
    Class<?> virtualFile = ClasspathHelper.contextClassLoader().loadClass("org.jboss.vfs.VirtualFile");
    java.io.File physicalFile = (java.io.File) virtualFile.getMethod("getPhysicalFile").invoke(content);
    String name = (String) virtualFile.getMethod("getName").invoke(content);
    java.io.File file = new java.io.File(physicalFile.getParentFile(), name);
    if (!file.exists() || !file.canRead()) file = physicalFile;
    return file.isDirectory() ? new SystemDir(file) : new ZipDir(new JarFile(file));
  }
},

代码示例来源:origin: org.rapidpm/rapidpm-dependencies-core-reflections

public Dir createDir(URL url) throws Exception {
  try {
   URLConnection urlConnection = url.openConnection();
   if (urlConnection instanceof JarURLConnection) {
    return new ZipDir(((JarURLConnection) urlConnection).getJarFile());
   }
  } catch (Throwable e) { /*fallback*/ }
  java.io.File file = getFile(url);
  if (file != null) {
   return new ZipDir(new JarFile(file));
  }
  return null;
 }
},

代码示例来源:origin: io.silverware/microservices

@Override
 public Vfs.Dir createDir(final URL url) throws IOException, URISyntaxException {
   final File file = new File(url.toURI());
   if (file.isDirectory()) {
    return new SystemDir(file);
   } else {
    return new ZipDir(new JarFile(file));
   }
 }
}

代码示例来源:origin: ai.h2o/reflections

public Dir createDir(URL url) throws Exception {
    try {
      URLConnection urlConnection = url.openConnection();
      if (urlConnection instanceof JarURLConnection) {
          return new ZipDir(((JarURLConnection) urlConnection).getJarFile());
      }
    } catch (Throwable e) { /*fallback*/ }
    java.io.File file = getFile(url);
    if (file != null) {
      return new ZipDir(new JarFile(file));
    }
    return null;
  }
},

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections

public Dir createDir(final URL url) {
  try {
    URL adaptedUrl = adaptURL(url);
    return new ZipDir(new JarFile(adaptedUrl.getFile()));
  } catch (Exception e) {
    try {
      return new ZipDir(new JarFile(url.getFile()));
    } catch (IOException e1) {
      if (Reflections.log != null) {
        Reflections.log.warn("Could not get URL", e);
        Reflections.log.warn("Could not get URL", e1);
      }
    }
  }
  return null;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections

public Dir createDir(final URL url) throws Exception {
    return new ZipDir(new JarFile(getFile(url)));
  }
},

相关文章