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 enumThe common names of cpu architectures.static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate static StubLoader.CPUprivate static Throwableprivate static final Stringprivate static final Stringprivate static final Fileprivate static final Stringprivate static booleanprivate static final Localeprivate static StubLoader.OSprivate static final Stringprivate static final Stringprivate static final Stringstatic final Stringprivate static final Stringstatic final Stringstatic final intstatic final intprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static FilecalculateExtractPath(File tmpDirFile) (package private) static FilecalculateExtractPath(File tmpDirFile, String jffiExtractName) private static StubLoader.CPUDetermines the CPU architecture the JVM is running on.private static StubLoader.OSDetermines the operating system jffi is running onprivate static SecurityExceptiondigestMismatchError(File dstFile) (package private) static Stringprivate static Stringprivate static Stringstatic StubLoader.CPUgetCPU()static final Throwablestatic StubLoader.OSgetOS()static StringGets the name of thisPlatform.private static InputStreamgetResourceAsStream(String resourceName) private static StringGets the name of the stub library.private static StringGets the path within the jar file of the stub native library.private static InputStreamGets anInputStreamrepresenting the stub library image stored in the jar file.private static intgetVersionField(String name) static final booleanisLoaded()(package private) static voidload()Loads the stub libraryprivate static booleanloadFromBootPath(String libName, String bootPath, Collection<Throwable> errors) private static voidloadFromJar(File tmpDirFile) private static SecurityExceptionsizeMismatchError(File dstFile, int sourceSize, int targetSize) private static UnsatisfiedLinkErrorprivate static IOExceptionprivate static voidunpackLibrary(File dstFile, InputStream sourceIS) private static voidverifyExistingLibrary(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
OSenum.
-
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
CPUenum.
-
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:
IOExceptionLinkageError
-
unpackLibrary
- Throws:
IOException
-
verifyExistingLibrary
- Throws:
IOException
-
sizeMismatchError
-
digestMismatchError
-
calculateExtractPath
- Throws:
IOException
-
calculateExtractPath
- Throws:
IOException
-
tempReadonlyError
-
tempLoadError
-
getStubLibraryStream
Gets anInputStreamrepresenting the stub library image stored in the jar file.- Returns:
- A new
InputStream
-
getResourceAsStream
-
getVersionField
-