Top Description Inners Fields Constructors Methods
org.conscrypt

pack-priv final Class NativeCryptoJni

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .Comparator, .List, org.conscrypt.NativeLibraryLoader.LoadResult

Helper to initialize the JNI libraries. This version runs when compiled as part of a host OpenJDK build.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
NativeCryptoJni.ErrorComparator

Sorts the errors in a list in descending order of value.

Field Summary

Modifier and TypeField and Description
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static String
private static ClassLoader
pack-priv static void
init()

Attempts to load the shared JNI library.

private static void
private static String
private static String
private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DYNAMIC_LIB_NAME_PREFIXback to summary
private static final String DYNAMIC_LIB_NAME_PREFIX
STATIC_LIB_NAMEback to summary
private static final String STATIC_LIB_NAME

Constructor Detail

NativeCryptoJniback to summary
private NativeCryptoJni()

Method Detail

archNameback to summary
private static String archName()
classLoaderback to summary
private static ClassLoader classLoader()
initback to summary
pack-priv static void init() throws 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).

Exceptions
UnsatisfiedLinkError:
if the library failed to load.
logResultsback to summary
private static void logResults(List<NativeLibraryLoader.LoadResult> results)
osNameback to summary
private static String osName()
platformLibNameback to summary
private static String platformLibName()
throwBestErrorback to summary
private static void throwBestError(List<NativeLibraryLoader.LoadResult> results)
org.conscrypt back to summary

private final Class NativeCryptoJni.ErrorComparator

extends Object
implements Comparator<NativeLibraryLoader.LoadResult>
Class Inheritance
All Implemented Interfaces
java.util.Comparator

Sorts the errors in a list in descending order of value. After a list is sorted, the first element is the most important error.

Field Summary

Modifier and TypeField and Description
pack-priv static final NativeCryptoJni.ErrorComparator

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int
compare(NativeLibraryLoader.LoadResult
the first object to be compared.
o1
,
NativeLibraryLoader.LoadResult
the second object to be compared.
o2
)

Implements java.util.Comparator.compare.

Compares its two arguments for order.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
pack-priv static final NativeCryptoJni.ErrorComparator INSTANCE

Constructor Detail

ErrorComparatorback to summary
private ErrorComparator()

Method Detail

compareback to summary
public int compare(NativeLibraryLoader.LoadResult o1, NativeLibraryLoader.LoadResult o2)

Implements java.util.Comparator.compare.

Doc from java.util.Comparator.compare.

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must ensure that signum(compare(x, y)) == -signum(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementor must ensure that compare(x, y)==0 implies that signum(compare(x, z))==signum(compare(y, z)) for all z.

Parameters
o1:NativeLibraryLoader.LoadResult

the first object to be compared.

o2:NativeLibraryLoader.LoadResult

the second object to be compared.

Returns:int

a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Annotations
@Override