Package org.lwjgl.system
Class LibraryResource
java.lang.Object
org.lwjgl.system.LibraryResource
Handles loading of native resources in LWJGL. [INTERNAL USE ONLY]
This class uses the same mechanism as Library
for loading shared libraries. The resource name could be an absolute path, or a relative path that
is resolved via org.lwjgl.librarypath
, java.library.path
, or even the class/module-path. When the resource is detected in the
class/module-path, it is extracted automatically to org.lwjgl.librarypath
via the SharedLibraryLoader
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Path
Loads a library resource.static Path
Loads a library resource.static Path
Loads a library resource usingload(String, String)
with the name specified byname
.static Path
load
(Class<?> context, String module, Configuration<String> name, @Nullable Supplier<Path> fallback, String... defaultNames) Loads a library resource usingload
with the name specified byname
.static Path
Callsload(Class, String, String)
usingLibraryResource.class
as the context parameter.
-
Method Details
-
load
Callsload(Class, String, String)
usingLibraryResource.class
as the context parameter. -
load
Loads a library resource.- Parameters:
context
- the class to use to discover the library resource in the classpathmodule
- the module to which the resource belongsname
- the resource name- Returns:
- the library resource path
- Throws:
IllegalStateException
- if the resource could not be found
-
load
Loads a library resource.- Parameters:
context
- the class to use to discover the library resource in the classpathmodule
- the module to which the resource belongsname
- the resource namebundledWithLWJGL
- whether the default LWJGL distribution includes the resource. If true, LWJGL will also try to find the shared library under the<platform>/<arch>/<module>
subfolder.- Returns:
- the library resource path
- Throws:
IllegalStateException
- if the resource could not be found
-
load
public static Path load(Class<?> context, String module, Configuration<String> name, String... defaultNames) Loads a library resource usingload(String, String)
with the name specified byname
. Ifname
is not set,load(String, String)
will be called with the names specified bydefaultNames
. The first successful will be returned.- Parameters:
name
- aConfiguration
that specifies the resource namedefaultNames
- the default resource name(s)- Returns:
- the library resource path
- Throws:
IllegalStateException
- if the resource could not be found
-
load
public static Path load(Class<?> context, String module, Configuration<String> name, @Nullable Supplier<Path> fallback, String... defaultNames) Loads a library resource usingload
with the name specified byname
. Ifname
is not set,load
will be called with the names specified bydefaultNames
. The first successful will be returned. If the resource could not be found, thefallback
will be called.- Parameters:
name
- aConfiguration
that specifies the resource namefallback
- fallback to use if everything else failsdefaultNames
- the default resource name(s)- Returns:
- the library resource path
- Throws:
UnsatisfiedLinkError
- if the resource could not be found
-