Package edu.wpi.first.util
Class RuntimeLoader<T>
java.lang.Object
edu.wpi.first.util.RuntimeLoader<T>
- Type Parameters:
T
- The class to load.
public final class RuntimeLoader<T> extends Object
Loads a native library at runtime.
-
Constructor Summary
Constructors Constructor Description RuntimeLoader(String libraryName, String extractionRoot, Class<T> cls)
Creates a new library loader. -
Method Summary
Modifier and Type Method Description static String
getDefaultExtractionRoot()
Gets the default extraction root location (~/.wpilib/nativecache).void
loadLibrary()
Loads a native library.void
loadLibraryHashed()
Load a native library by directly hashing the file.
-
Constructor Details
-
RuntimeLoader
Creates a new library loader.- Parameters:
libraryName
- Name of library to load.extractionRoot
- Location from which to load the library.cls
- Class whose classpath the given library belongs.
-
-
Method Details
-
getDefaultExtractionRoot
Gets the default extraction root location (~/.wpilib/nativecache).- Returns:
- The default extraction root location.
-
loadLibrary
Loads a native library.- Throws:
IOException
- if the library fails to load
-
loadLibraryHashed
Load a native library by directly hashing the file.- Throws:
IOException
- if the library failed to load
-