Package org.conscrypt
Class NativeCryptoJni
- java.lang.Object
-
- org.conscrypt.NativeCryptoJni
-
final class NativeCryptoJni extends java.lang.Object
Helper to initialize the JNI libraries. This version runs when compiled as part of a host OpenJDK build.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
NativeCryptoJni.ErrorComparator
Sorts the errors in a list in descending order of value.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
DYNAMIC_LIB_NAME_PREFIX
private static java.lang.String
STATIC_LIB_NAME
-
Constructor Summary
Constructors Modifier Constructor Description private
NativeCryptoJni()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
archName()
private static java.lang.ClassLoader
classLoader()
(package private) static void
init()
Attempts to load the shared JNI library.private static void
logResults(java.util.List<NativeLibraryLoader.LoadResult> results)
private static java.lang.String
osName()
private static java.lang.String
platformLibName()
private static void
throwBestError(java.util.List<NativeLibraryLoader.LoadResult> results)
-
-
-
Field Detail
-
STATIC_LIB_NAME
private static final java.lang.String STATIC_LIB_NAME
- See Also:
- Constant Field Values
-
DYNAMIC_LIB_NAME_PREFIX
private static final java.lang.String DYNAMIC_LIB_NAME_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
static void init() throws java.lang.UnsatisfiedLinkError
Attempts to load the shared JNI library. First try loading the platform-specific library name (e.g. conscrypt_openjdk_jni-linux-x86_64). If that doesn't work, try to load the library via just the prefix (e.g. conscrypt_openjdk_jni). If not found, try the static library name. The non-suffixed dynamic library name is used by the Android build system, which builds the appropriate library for the system it's being run on under that name. The static library name is needed in order to support Java 8 static linking (http://openjdk.java.net/jeps/178), where the library name is used to invoke a library-specific load method (i.e.JNI_OnLoad_conscrypt
).- Throws:
java.lang.UnsatisfiedLinkError
- if the library failed to load.
-
logResults
private static void logResults(java.util.List<NativeLibraryLoader.LoadResult> results)
-
throwBestError
private static void throwBestError(java.util.List<NativeLibraryLoader.LoadResult> results)
-
classLoader
private static java.lang.ClassLoader classLoader()
-
platformLibName
private static java.lang.String platformLibName()
-
osName
private static java.lang.String osName()
-
archName
private static java.lang.String archName()
-
-