A resource is a file or other fixed data that an application may access. Resources are part of the application and are shipped with it, but are stored in external files. Examples are images, sounds, and translation (localization) of messages. In the Java world a resource is commonly bundled in the same jar file as the application itself.
Syntax: resource-url
resource-name
Returns a
URLPath
you can use as aURL
, or you can pass to itopen-input-file
to read the resource data. Theresource-name
is a string which is passed to theClassLoader
of the containing module. If the module class is in a jar file, things will magically work if the resource is in the same jar file, andresource-name
is a filename relative to the module class in the jar. If the module is immediately evaluated, theresource-name
is resolved against the location of the module source file.
Evaluates to a special URI that can be used to access resources relative to the class of the containing module. The URI has the form
"class-resource://
in compiled code, to allow moving the classes/jars. The currentCurrentClass
/"ClassLoader
is associated with the URI, so accessing resources using the URI will use thatClassLoader
. Therefore you should not create a"class-resource:"
URI except by using this function orresolve-uri
, since that might try to use the wrongClassLoader
.The macro
resource-url
works by usingmodule-uri
and resolving that to a normalURL
.
Evaluates to the containing module class, as a
java.lang.Class
instance.