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

Method getResource

src/main/java/gate/util/Files.java:388–406  ·  view source on GitHub ↗

Get a resource from the GATE ClassLoader. The return value is a java.net.URL that can be used to retrieve the contents of the resource.

(String resourceName)

Source from the content-addressed store, hash-verified

386 * resource.
387 */
388 public static URL getResource(String resourceName) {
389 // Strip any leading '/'
390 if(resourceName.charAt(0) == '/') {
391 resourceName = resourceName.substring(1);
392 }
393
394 ClassLoader gcl = Gate.getClassLoader();
395 if(gcl == null) {
396 // if the GATE ClassLoader has not been initialised yet (i.e. this
397 // method was called before Gate.init) then fall back to the current
398 // classloader
399 return Files.class.getClassLoader().getResource(resourceName);
400 }
401 else {
402 // if we can, get the resource through the GATE ClassLoader to allow
403 // loading of resources from plugin JARs as well as gate.jar
404 return gcl.getResource(resourceName);
405 }
406 }
407
408 /**
409 * Get a resource from the GATE resources directory. The return value is a

Callers 15

getGateResourceMethod · 0.95
getTestServerNameMethod · 0.45
testReadFromURLMethod · 0.45
resourceUnloadedMethod · 0.45
resourceUnloadedMethod · 0.45
resourceDeletedMethod · 0.45
resourceUnloadedMethod · 0.45
resourceUnloadedMethod · 0.45
getPluginMethod · 0.45
transferStartedMethod · 0.45
transferProgressedMethod · 0.45
transferCorruptedMethod · 0.45

Calls 2

getClassLoaderMethod · 0.95
charAtMethod · 0.80

Tested by 2

getTestServerNameMethod · 0.36
testReadFromURLMethod · 0.36