MCPcopy Create free account
hub / github.com/GateNLP/gate-core / scanJar

Method scanJar

src/main/java/gate/creole/Plugin.java:499–523  ·  view source on GitHub ↗
(URL jarUrl, Map<String, ResourceInfo> resInfos)

Source from the content-addressed store, hash-verified

497 }
498
499 protected void scanJar(URL jarUrl, Map<String, ResourceInfo> resInfos)
500 throws IOException {
501 JarInputStream jarInput = new JarInputStream(jarUrl.openStream(), false);
502 JarEntry entry = null;
503 while((entry = jarInput.getNextJarEntry()) != null) {
504 String entryName = entry.getName();
505 if(entryName != null && entryName.endsWith(".class")) {
506 final String className =
507 entryName.substring(0, entryName.length() - 6).replace('/', '.');
508 if(!resInfos.containsKey(className)) {
509 ClassReader classReader = new ClassReader(jarInput);
510 ResourceInfo resInfo = new ResourceInfo(null, className, null);
511 ResourceInfoVisitor visitor = new ResourceInfoVisitor(resInfo);
512
513 classReader.accept(visitor, ClassReader.SKIP_CODE
514 | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
515 if(visitor.isCreoleResource()) {
516 resInfos.put(className, resInfo);
517 }
518 }
519 }
520 }
521
522 jarInput.close();
523 }
524
525 protected void fillInResInfos(List<ResourceInfo> incompleteResInfos,
526 List<String> allJars) throws IOException {

Callers 1

parseCreoleMethod · 0.95

Calls 8

isCreoleResourceMethod · 0.95
openStreamMethod · 0.80
acceptMethod · 0.80
getNameMethod · 0.65
closeMethod · 0.65
lengthMethod · 0.45
containsKeyMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected