Package edu.wpi.first.util
Class CombinedRuntimeLoader
java.lang.Object
edu.wpi.first.util.CombinedRuntimeLoader
Loads dynamic libraries for all platforms.
-
Method Summary
Modifier and TypeMethodDescriptionextractLibraries(Class<T> clazz, String resourceName) Extract a list of native libraries.static StringGets the default extraction root location (~/.wpilib/nativecache) for use if setExtractionDirectory is not set.static StringReturns library extraction directory.static StringReturns platform path.static <T> voidloadLibraries(Class<T> clazz, String... librariesToLoad) Load a list of native libraries out of a single directory.static voidloadLibrary(String libraryName, List<String> extractedFiles) Load a single library from a list of extracted files.
-
Method Details
-
getExtractionDirectory
Returns library extraction directory.- Returns:
- Library extraction directory.
-
getDefaultExtractionRoot
Gets the default extraction root location (~/.wpilib/nativecache) for use if setExtractionDirectory is not set.- Returns:
- The default extraction root location.
-
getPlatformPath
Returns platform path.- Returns:
- The current platform path.
- Throws:
IllegalStateException- Thrown if the operating system is unknown.
-
extractLibraries
public static <T> List<String> extractLibraries(Class<T> clazz, String resourceName) throws IOException Extract a list of native libraries.- Type Parameters:
T- The class where the resources would be located- Parameters:
clazz- The actual class objectresourceName- The resource name on the classpath to use for file lookup- Returns:
- List of all libraries that were extracted
- Throws:
IOException- Thrown if resource not found or file could not be extracted
-
loadLibrary
Load a single library from a list of extracted files.- Parameters:
libraryName- The library name to loadextractedFiles- The extracted files to search- Throws:
IOException- If library was not found
-
loadLibraries
Load a list of native libraries out of a single directory.- Type Parameters:
T- The class where the resources would be located- Parameters:
clazz- The actual class objectlibrariesToLoad- List of libraries to load- Throws:
IOException- Throws an IOException if not found
-