- All Known Subinterfaces:
 Resource
Resource represents a resource on the classpath.
 WARNING: a Resource must provide correct
 equals and hashCode
 implementations since a Resource may potentially be stored in a
 collection or map.
- Since:
 - 1.14
 - See Also:
 
- 
Method Summary
Modifier and TypeMethodDescriptiondefault InputStreamGet anInputStreamfor reading this resource.getName()Get the name of this resource.getUri()Get the URI of this resource.static ResourceCreate a newResourcewith the given name and URI. 
- 
Method Details
- 
of
Create a newResourcewith the given name and URI.- Parameters:
 name- the name of the resource; nevernulluri- the URI of the resource; nevernull- Returns:
 - a new 
Resource - Since:
 - 1.14
 
 - 
getName
String getName()Get the name of this resource.The resource name is a
/-separated path. The path is relative to the classpath root in which the resource is located.- Returns:
 - the resource name; never 
null 
 - 
getUri
URI getUri()Get the URI of this resource.- Returns:
 - the URI of the resource; never 
null 
 - 
getInputStream
Get anInputStreamfor reading this resource.The default implementation delegates to
URL.openStream()for this resource'sURI.- Returns:
 - an input stream for this resource; never 
null - Throws:
 IOException- if an I/O exception occurs
 
 -