java.lang.System.mapLibraryName()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(348)

本文整理了Java中java.lang.System.mapLibraryName()方法的一些代码示例,展示了System.mapLibraryName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。System.mapLibraryName()方法的具体详情如下:
包路径:java.lang.System
类名称:System
方法名:mapLibraryName

System.mapLibraryName介绍

[英]Returns the platform specific file name format for the shared library named by the argument.
[中]

代码示例

代码示例来源:origin: fengjiachun/Jupiter

  1. public static String mapLibraryName(String libname) {
  2. return System.mapLibraryName(libname);
  3. }
  4. }

代码示例来源:origin: fengjiachun/Jupiter

  1. public static String mapLibraryName(String libname) {
  2. return System.mapLibraryName(libname);
  3. }
  4. }

代码示例来源:origin: apache/ignite

  1. /**
  2. * @return Maps library name to file name.
  3. */
  4. private static String mapLibraryName(String name) {
  5. String libName = System.mapLibraryName(name);
  6. if (U.isMacOs() && libName.endsWith(".jnilib"))
  7. return libName.substring(0, libName.length() - "jnilib".length()) + "dylib";
  8. return libName;
  9. }

代码示例来源:origin: stackoverflow.com

  1. private static void loadLib(String path, String name) {
  2. name = System.mapLibraryName(name); // extends name with .dll, .so or .dylib
  3. try {
  4. InputStream in = ACWrapper.class.getResourceAsStream("/"+path + name);
  5. File fileOut = new File("your lib path");
  6. OutputStream out = FileUtils.openOutputStream(fileOut);
  7. IOUtils.copy(in, out);
  8. in.close();
  9. out.close();
  10. System.load(fileOut.toString());//loading goes here
  11. } catch (Exception e) {
  12. //handle
  13. }
  14. }

代码示例来源:origin: redisson/redisson

  1. /**
  2. * Make a call to {@link System#loadLibrary(String)} to load the native library which assumes
  3. * that the library is available on the path based on this {@link Bundle}'s {@link Manifest}.
  4. */
  5. public void start(BundleContext context)
  6. throws Exception
  7. {
  8. String library = System.mapLibraryName(LIBRARY_NAME);
  9. if (library.toLowerCase().endsWith(".dylib")) {
  10. // some MacOS JDK7+ vendors map to dylib instead of jnilib
  11. library = library.replace(".dylib", ".jnilib");
  12. }
  13. System.loadLibrary(library);
  14. SnappyLoader.setSnappyApi(new SnappyNative());
  15. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Finds a native library. This class loader first searches its own library
  3. * path (as specified in the constructor) and then the system library path.
  4. * In Android 2.2 and earlier, the search order was reversed.
  5. *
  6. * @param libname
  7. * The name of the library to find
  8. * @return the complete path of the library, or {@code null} if the library
  9. * is not found.
  10. */
  11. public String findLibrary(String libname) {
  12. init();
  13. String fileName = System.mapLibraryName(libname);
  14. for (String pathElement : libraryPathElements) {
  15. String pathName = pathElement + fileName;
  16. File test = new File(pathName);
  17. if (test.exists()) {
  18. return pathName;
  19. }
  20. }
  21. return null;
  22. }

代码示例来源:origin: osmandapp/Osmand

  1. System.load(path + "/" + System.mapLibraryName(libBaseName));
  2. return true;
  3. } catch (UnsatisfiedLinkError e) {

代码示例来源:origin: bytedeco/javacpp

  1. p.put("platform", name);
  2. p.put("platform.path.separator", File.pathSeparator);
  3. String s = System.mapLibraryName("/");
  4. int i = s.indexOf('/');
  5. p.put("platform.library.prefix", s.substring(0, i));

代码示例来源:origin: redisson/redisson

  1. snappyNativeLibraryName = System.mapLibraryName("snappyjava");

代码示例来源:origin: netty/netty

  1. String libname = System.mapLibraryName(name);
  2. String path = NATIVE_RESOURCE_HOME + libname;

代码示例来源:origin: apache/geode

  1. File libraryPath = new File(libDir, System.mapLibraryName(library));
  2. if (libraryPath.exists()) {
  3. System.load(libraryPath.getPath());

代码示例来源:origin: io.netty/netty

  1. String libname = System.mapLibraryName(name);
  2. String path = NATIVE_RESOURCE_HOME + libname;

代码示例来源:origin: redisson/redisson

  1. String libname = System.mapLibraryName(name);
  2. String path = NATIVE_RESOURCE_HOME + libname;

代码示例来源:origin: robovm/robovm

  1. handle = Dl.open(null);
  2. } else {
  3. String libName = System.mapLibraryName(name);
  4. for (String searchPath : searchPaths) {
  5. File f = new File(searchPath, libName);

代码示例来源:origin: robovm/robovm

  1. String filename = System.mapLibraryName(libraryName);
  2. List<String> candidates = new ArrayList<String>();
  3. String lastError = null;

代码示例来源:origin: koral--/android-gif-drawable

  1. final String mappedSurfaceLibraryName = System.mapLibraryName(LibraryLoader.SURFACE_LIBRARY_NAME);
  2. final FilenameFilter filter = new FilenameFilter() {
  3. @Override

代码示例来源:origin: wildfly/wildfly

  1. String libname = System.mapLibraryName(name);
  2. String path = NATIVE_RESOURCE_HOME + libname;

代码示例来源:origin: KeepSafe/ReLinker

  1. @Override
  2. public String mapLibraryName(final String libraryName) {
  3. if (libraryName.startsWith("lib") && libraryName.endsWith(".so")) {
  4. // Already mapped
  5. return libraryName;
  6. }
  7. return System.mapLibraryName(libraryName);
  8. }

代码示例来源:origin: mulesoft/mule

  1. private File copyNativeLibrary(String name, String libraryPath) {
  2. final String nativeLibName = System.mapLibraryName(name);
  3. final File tempLibrary = new File(artifactTempFolder, nativeLibName + System.currentTimeMillis());
  4. try {
  5. final File library = new File(decode(libraryPath, defaultCharset().name()));
  6. copyFile(library, tempLibrary);
  7. return tempLibrary;
  8. } catch (IOException e) {
  9. throw new IllegalStateException(String.format("Unable to generate copy for native library '%s' at '%s'", nativeLibName,
  10. tempLibrary.getAbsolutePath()),
  11. e);
  12. }
  13. }

代码示例来源:origin: mulesoft/mule

  1. private String getJniLibFileName() {
  2. String libraryFileName = System.mapLibraryName(TEST_LIB_NAME);
  3. int index = libraryFileName.lastIndexOf(".");
  4. libraryFileName = libraryFileName.substring(0, index) + JNILIB_EXTENSION;
  5. return libraryFileName;
  6. }
  7. }

相关文章