private JarEntryInfo findJarNativeEntry ( String libraryName ) { String name = System . mapLibraryName ( libraryName ) ; for ( JarFileInfo jarFileInfo : jarFiles ) { JarFile jarFile = jarFileInfo . getJarFile ( ) ; Enumeration < JarEntry > entries = jarFile . entries ( ) ; while ( entries . hasMoreElements ( ) ) { JarEntry jarEntry = entries . nextElement ( ) ; if ( jarEntry . isDirectory ( ) ) { continue ; } // Example: name is "Native.dll" String jarEntryName = jarEntry . getName ( ) ; // "Native.dll" or "abc/xyz/Native.dll" // name "Native.dll" could be found, for example // - in the path: abc/Native.dll/xyz/my.dll <-- do not load this one! // - in the partial name: abc/aNative.dll <-- do not load this one! String [ ] token = jarEntryName . split ( "/" ) ; // the last token is library name if ( token . length > 0 && token [ token . length - 1 ] . equals ( name ) ) { debug ( String . format ( "Loading native library '%s' found as '%s' in JAR %s" , libraryName , jarEntryName , jarFileInfo . getSimpleName ( ) ) ) ; return new JarEntryInfo ( jarFileInfo , jarEntry ) ; } } } return null ; }
Finds native library entry .