Top Description Constructors Methods
org.lwjgl.system

public final Class LibraryResource

extends Object
Class Inheritance
Imports
javax.annotation.*, java.net.*, java.nio.channels.*, java.nio.file.*, java.util.function.*

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.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Path
load(String module, String name)

Calls load(Class, String, String) using LibraryResource.class as the context parameter.

public static Path

Returns:

the library resource path
load
(Class<?>
the class to use to discover the library resource in the classpath
context
,
String
the module to which the resource belongs
module
,
String
the resource name
name
)

Loads a library resource.

public static Path

Returns:

the library resource path
load
(Class<?>
the class to use to discover the library resource in the classpath
context
,
String
the module to which the resource belongs
module
,
String
the resource name
name
,
boolean
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.
bundledWithLWJGL
)

Loads a library resource.

private static Path
load(Class<?> context, String module, String name, boolean bundledWithLWJGL, boolean printError)

private static Path
load(String module, String name, boolean bundledWithLWJGL, String property, String paths)

public static Path

Returns:

the library resource path
load
(Class<?> context, String module, Configuration<String>
a Configuration that specifies the resource name
name
,
String...
the default resource name(s)
defaultNames
)

Loads a library resource using load(String, String) with the name specified by name.

public static Path

Returns:

the library resource path
load
(Class<?> context, String module, Configuration<String>
a Configuration that specifies the resource name
name
,
Supplier<Path>
fallback to use if everything else fails
fallback
,
String...
the default resource name(s)
defaultNames
)

Loads a library resource using load with the name specified by name.

private static Path
loadFromLibraryPath(String module, String libName, boolean bundledWithLWJGL)

private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LibraryResourceback to summary
private LibraryResource()

Method Detail

loadback to summary
public static Path load(String module, String name)

Calls load(Class, String, String) using LibraryResource.class as the context parameter.

loadback to summary
public static Path load(Class<?> context, String module, String name)

Loads a library resource.

Parameters
context:Class<?>

the class to use to discover the library resource in the classpath

module:String

the module to which the resource belongs

name:String

the resource name

Returns:Path

the library resource path

Annotations
@SuppressWarnings:try
Exceptions
IllegalStateException:
if the resource could not be found
loadback to summary
public static Path load(Class<?> context, String module, String name, boolean bundledWithLWJGL)

Loads a library resource.

Parameters
context:Class<?>

the class to use to discover the library resource in the classpath

module:String

the module to which the resource belongs

name:String

the resource name

bundledWithLWJGL:boolean

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:Path

the library resource path

Annotations
@SuppressWarnings:try
Exceptions
IllegalStateException:
if the resource could not be found
loadback to summary
private static Path load(Class<?> context, String module, String name, boolean bundledWithLWJGL, boolean printError)
Annotations
@SuppressWarnings:try
loadback to summary
private static Path load(String module, String name, boolean bundledWithLWJGL, String property, String paths)
Annotations
@Nullable
loadback to summary
public static Path load(Class<?> context, String module, Configuration<String> name, String... defaultNames)

Loads a library resource using load(String, String) with the name specified by name. If name is not set, load(String, String) will be called with the names specified by defaultNames. The first successful will be returned.

Parameters
name:Configuration<String>

a Configuration that specifies the resource name

defaultNames:String[]

the default resource name(s)

Returns:Path

the library resource path

Exceptions
IllegalStateException:
if the resource could not be found
loadback to summary
public static Path load(Class<?> context, String module, Configuration<String> name, Supplier<Path> fallback, String... defaultNames)

Loads a library resource using load with the name specified by name. If name is not set, load will be called with the names specified by defaultNames. The first successful will be returned. If the resource could not be found, the fallback will be called.

Parameters
name:Configuration<String>

a Configuration that specifies the resource name

fallback:Supplier<Path>

fallback to use if everything else fails

defaultNames:String[]

the default resource name(s)

Returns:Path

the library resource path

Exceptions
UnsatisfiedLinkError:
if the resource could not be found
loadFromLibraryPathback to summary
private static Path loadFromLibraryPath(String module, String libName, boolean bundledWithLWJGL)
Annotations
@Nullable
printErrorback to summary
private static void printError()