本文整理了Java中java.lang.System.mapLibraryName()
方法的一些代码示例,展示了System.mapLibraryName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。System.mapLibraryName()
方法的具体详情如下:
包路径:java.lang.System
类名称:System
方法名:mapLibraryName
[英]Returns the platform specific file name format for the shared library named by the argument.
[中]
代码示例来源:origin: fengjiachun/Jupiter
public static String mapLibraryName(String libname) {
return System.mapLibraryName(libname);
}
}
代码示例来源:origin: fengjiachun/Jupiter
public static String mapLibraryName(String libname) {
return System.mapLibraryName(libname);
}
}
代码示例来源:origin: apache/ignite
/**
* @return Maps library name to file name.
*/
private static String mapLibraryName(String name) {
String libName = System.mapLibraryName(name);
if (U.isMacOs() && libName.endsWith(".jnilib"))
return libName.substring(0, libName.length() - "jnilib".length()) + "dylib";
return libName;
}
代码示例来源:origin: stackoverflow.com
private static void loadLib(String path, String name) {
name = System.mapLibraryName(name); // extends name with .dll, .so or .dylib
try {
InputStream in = ACWrapper.class.getResourceAsStream("/"+path + name);
File fileOut = new File("your lib path");
OutputStream out = FileUtils.openOutputStream(fileOut);
IOUtils.copy(in, out);
in.close();
out.close();
System.load(fileOut.toString());//loading goes here
} catch (Exception e) {
//handle
}
}
代码示例来源:origin: redisson/redisson
/**
* Make a call to {@link System#loadLibrary(String)} to load the native library which assumes
* that the library is available on the path based on this {@link Bundle}'s {@link Manifest}.
*/
public void start(BundleContext context)
throws Exception
{
String library = System.mapLibraryName(LIBRARY_NAME);
if (library.toLowerCase().endsWith(".dylib")) {
// some MacOS JDK7+ vendors map to dylib instead of jnilib
library = library.replace(".dylib", ".jnilib");
}
System.loadLibrary(library);
SnappyLoader.setSnappyApi(new SnappyNative());
}
代码示例来源:origin: robovm/robovm
/**
* Finds a native library. This class loader first searches its own library
* path (as specified in the constructor) and then the system library path.
* In Android 2.2 and earlier, the search order was reversed.
*
* @param libname
* The name of the library to find
* @return the complete path of the library, or {@code null} if the library
* is not found.
*/
public String findLibrary(String libname) {
init();
String fileName = System.mapLibraryName(libname);
for (String pathElement : libraryPathElements) {
String pathName = pathElement + fileName;
File test = new File(pathName);
if (test.exists()) {
return pathName;
}
}
return null;
}
代码示例来源:origin: osmandapp/Osmand
System.load(path + "/" + System.mapLibraryName(libBaseName));
return true;
} catch (UnsatisfiedLinkError e) {
代码示例来源:origin: bytedeco/javacpp
p.put("platform", name);
p.put("platform.path.separator", File.pathSeparator);
String s = System.mapLibraryName("/");
int i = s.indexOf('/');
p.put("platform.library.prefix", s.substring(0, i));
代码示例来源:origin: redisson/redisson
snappyNativeLibraryName = System.mapLibraryName("snappyjava");
代码示例来源:origin: netty/netty
String libname = System.mapLibraryName(name);
String path = NATIVE_RESOURCE_HOME + libname;
代码示例来源:origin: apache/geode
File libraryPath = new File(libDir, System.mapLibraryName(library));
if (libraryPath.exists()) {
System.load(libraryPath.getPath());
代码示例来源:origin: io.netty/netty
String libname = System.mapLibraryName(name);
String path = NATIVE_RESOURCE_HOME + libname;
代码示例来源:origin: redisson/redisson
String libname = System.mapLibraryName(name);
String path = NATIVE_RESOURCE_HOME + libname;
代码示例来源:origin: robovm/robovm
handle = Dl.open(null);
} else {
String libName = System.mapLibraryName(name);
for (String searchPath : searchPaths) {
File f = new File(searchPath, libName);
代码示例来源:origin: robovm/robovm
String filename = System.mapLibraryName(libraryName);
List<String> candidates = new ArrayList<String>();
String lastError = null;
代码示例来源:origin: koral--/android-gif-drawable
final String mappedSurfaceLibraryName = System.mapLibraryName(LibraryLoader.SURFACE_LIBRARY_NAME);
final FilenameFilter filter = new FilenameFilter() {
@Override
代码示例来源:origin: wildfly/wildfly
String libname = System.mapLibraryName(name);
String path = NATIVE_RESOURCE_HOME + libname;
代码示例来源:origin: KeepSafe/ReLinker
@Override
public String mapLibraryName(final String libraryName) {
if (libraryName.startsWith("lib") && libraryName.endsWith(".so")) {
// Already mapped
return libraryName;
}
return System.mapLibraryName(libraryName);
}
代码示例来源:origin: mulesoft/mule
private File copyNativeLibrary(String name, String libraryPath) {
final String nativeLibName = System.mapLibraryName(name);
final File tempLibrary = new File(artifactTempFolder, nativeLibName + System.currentTimeMillis());
try {
final File library = new File(decode(libraryPath, defaultCharset().name()));
copyFile(library, tempLibrary);
return tempLibrary;
} catch (IOException e) {
throw new IllegalStateException(String.format("Unable to generate copy for native library '%s' at '%s'", nativeLibName,
tempLibrary.getAbsolutePath()),
e);
}
}
代码示例来源:origin: mulesoft/mule
private String getJniLibFileName() {
String libraryFileName = System.mapLibraryName(TEST_LIB_NAME);
int index = libraryFileName.lastIndexOf(".");
libraryFileName = libraryFileName.substring(0, index) + JNILIB_EXTENSION;
return libraryFileName;
}
}
内容来源于网络,如有侵权,请联系作者删除!