MCPcopy Create free account
hub / github.com/antlr/codebuff / getResource

Method getResource

output/java_guava/1.4.17/Resources.java:200–208  ·  view source on GitHub ↗

Returns a URL pointing to resourceName if the resource is found using the plain Thread#getContextClassLoader() context class loader. In simple environments, the context class loader will find resources from the class path. In environments where different threads can have diffe

(String resourceName)

Source from the content-addressed store, hash-verified

198 */
199
200 @CanIgnoreReturnValue // being used to check if a resource exists
201 // TODO(cgdecker): maybe add a better way to check if a resource exists
202 // e.g. Optional<URL> tryGetResource or boolean resourceExists
203 public static URL getResource(String resourceName) {
204 ClassLoader loader = MoreObjects.firstNonNull(Thread.currentThread().getContextClassLoader(), Resources.class.getClassLoader());
205 URL url = loader.getResource(resourceName);
206 checkArgument(url != null, "resource %s not found.", resourceName);
207 return url;
208 }
209
210 /**
211 * Given a {@code resourceName} that is relative to {@code contextClass}, returns a {@code URL}

Callers 15

STGroupDirMethod · 0.45
getURLMethod · 0.45
STGroupDirMethod · 0.45
getURLMethod · 0.45
STGroupDirMethod · 0.45
getURLMethod · 0.45
STGroupDirMethod · 0.45
getURLMethod · 0.45
STGroupDirMethod · 0.45
getURLMethod · 0.45
STGroupDirMethod · 0.45
getURLMethod · 0.45

Calls 3

firstNonNullMethod · 0.95
checkArgumentMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected