Package com.kenai.jffi.internal
Class StubLoader
java.lang.Object
com.kenai.jffi.internal.StubLoader
Loads the native stub library. This is intended to only ever be called
reflectively, so it cannot access other jffi classes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The common names of cpu architectures.static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static StubLoader.CPU
private static Throwable
private static final String
private static final String
private static final File
private static final String
private static boolean
private static final Locale
private static StubLoader.OS
private static final String
private static final String
private static final String
static final String
private static final String
static final String
static final int
static final int
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static File
calculateExtractPath
(File tmpDirFile) (package private) static File
calculateExtractPath
(File tmpDirFile, String jffiExtractName) private static StubLoader.CPU
Determines the CPU architecture the JVM is running on.private static StubLoader.OS
Determines the operating system jffi is running onprivate static SecurityException
digestMismatchError
(File dstFile) (package private) static String
private static String
private static String
static StubLoader.CPU
getCPU()
static final Throwable
static StubLoader.OS
getOS()
static String
Gets the name of thisPlatform
.private static InputStream
getResourceAsStream
(String resourceName) private static String
Gets the name of the stub library.private static String
Gets the path within the jar file of the stub native library.private static InputStream
Gets anInputStream
representing the stub library image stored in the jar file.private static int
getVersionField
(String name) static final boolean
isLoaded()
(package private) static void
load()
Loads the stub libraryprivate static boolean
loadFromBootPath
(String libName, String bootPath, Collection<Throwable> errors) private static void
loadFromJar
(File tmpDirFile) private static SecurityException
sizeMismatchError
(File dstFile, int sourceSize, int targetSize) private static UnsatisfiedLinkError
private static IOException
private static void
unpackLibrary
(File dstFile, InputStream sourceIS) private static void
verifyExistingLibrary
(File dstFile, InputStream sourceIS)
-
Field Details
-
VERSION_MAJOR
public static final int VERSION_MAJOR -
VERSION_MINOR
public static final int VERSION_MINOR -
versionClassName
- See Also:
-
LOCALE
-
bootPropertyFilename
- See Also:
-
bootLibraryPropertyName
- See Also:
-
stubLibraryName
-
TMPDIR_ENV
-
TMPDIR
-
TMPDIR_RECOMMENDATION
-
TMPDIR_WRITE_ERROR
-
TMPDIR_EXEC_ERROR
-
os
-
cpu
-
failureCause
-
loaded
private static volatile boolean loaded -
jffiExtractDir
-
jffiExtractName
-
JFFI_EXTRACT_DIR
- See Also:
-
JFFI_EXTRACT_NAME
- See Also:
-
-
Constructor Details
-
StubLoader
public StubLoader()
-
-
Method Details
-
isLoaded
public static final boolean isLoaded() -
getFailureCause
-
determineOS
Determines the operating system jffi is running on- Returns:
- An member of the
OS
enum.
-
determineCPU
Determines the CPU architecture the JVM is running on. This normalizes all the variations that are equivalent (e.g. i386, x86, i86pc) into a common cpu type.- Returns:
- A member of the
CPU
enum.
-
getCPU
-
getOS
-
getStubLibraryName
Gets the name of the stub library.- Returns:
- The name of the stub library as a
String
-
getPlatformName
Gets the name of thisPlatform
.- Returns:
- The name of this platform.
-
getStubLibraryPath
Gets the path within the jar file of the stub native library.- Returns:
- The path of the jar file.
-
load
static void load()Loads the stub library -
getBootPath
-
getAlternateLibraryPath
-
loadFromBootPath
private static boolean loadFromBootPath(String libName, String bootPath, Collection<Throwable> errors) -
dlExtension
-
loadFromJar
- Throws:
IOException
LinkageError
-
unpackLibrary
- Throws:
IOException
-
verifyExistingLibrary
- Throws:
IOException
-
sizeMismatchError
-
digestMismatchError
-
calculateExtractPath
- Throws:
IOException
-
calculateExtractPath
- Throws:
IOException
-
tempReadonlyError
-
tempLoadError
-
getStubLibraryStream
Gets anInputStream
representing the stub library image stored in the jar file.- Returns:
- A new
InputStream
-
getResourceAsStream
-
getVersionField
-