Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. protected URL findURL(ClassLoader cl)
  2. {
  3. URL u = cl.getResource(nativeName);
  4. String nativeFile = (new StringBuffer("native/".length() + nativeName.length())).append("native/").append(nativeName).toString();
  5. String metaInfFile = (new StringBuffer("META-INF/".length() + nativeName.length())).append("META-INF/").append(nativeName).toString();
  6. if(u == null)
  7. u = cl.getResource(nativeFile);
  8. if(u == null)
  9. u = cl.getResource(metaInfFile);
  10. if(u == null)
  11. {
  12. File f = new File(nativeFile);
  13. if(f.exists())
  14. try
  15. {
  16. u = f.toURL();
  17. }
  18. catch(MalformedURLException malformedurlexception) { }
  19. }
  20. if(u == null)
  21. {
  22. File f = new File(metaInfFile);
  23. if(f.exists())
  24. try
  25. {
  26. u = f.toURL();
  27. }
  28. catch(MalformedURLException malformedurlexception1) { }
  29. }
  30. return u;
  31. }
  32.  
  33. public final String getGeneratedName()
  34. {
  35. return nativeName;
  36. }
  37.  
  38. public final String getName()
  39. {
  40. return name;
  41. }
  42.  
  43. public final String toString()
  44. {
  45. return toStringBuffer(null).toString();
  46. }
  47.  
  48. public StringBuffer toStringBuffer(StringBuffer in)
  49. {
  50. if(in == null)
  51. in = new StringBuffer(64);
  52. else
  53. in.ensureCapacity(in.length() + 64);
  54. in.append("{ NativeLoader: name = ");
  55. in.append(name);
  56. in.append(", nativeName = ");
  57. in.append(nativeName);
  58. in.append(" }");
  59. return in;
  60. }
  61.  
  62. private static String osPrefix;
  63. private static String osSuffix;
  64. private final String name;
  65. private final String nativeName;
  66. private boolean attemptedLoading;
  67. private boolean loadingSuccessful;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement