Author: tommy
Date: 2008-02-28 19:05:47 +0000 (Thu, 28 Feb 2008)
New Revision: 18221
Modified:
trunk/freenet/src/freenet/support/LibraryLoader.java
Log:
indent
Modified: trunk/freenet/src/freenet/support/LibraryLoader.java
===================================================================
--- trunk/freenet/src/freenet/support/LibraryLoader.java 2008-02-28
19:03:35 UTC (rev 18220)
+++ trunk/freenet/src/freenet/support/LibraryLoader.java 2008-02-28
19:05:47 UTC (rev 18221)
@@ -37,39 +37,39 @@
final String libraryNameWithPrefixAndArch =
libraryNameWithPrefix + '-' + getSimplifiedArchitecture();
final String libraryNameWithPrefixAndArchAndSuffix =
libraryNameWithPrefixAndArch + (isWindows ? ".dll" : ".so");
String resourceName = path +
libraryNameWithPrefixAndArchAndSuffix;
-
+
File nativeLib = new
File((System.getProperty("java.library.path")) + "/lib" + libraryName +
(isWindows ? ".dll" : ".so"));
if (nativeLib.exists()) {
System.out.println("Attempting to load the NativeThread
library ["+libraryName+']');
System.loadLibrary(libraryName);
} else {
- try {
- // Get the resource
- URL resource =
LibraryLoader.class.getResource(resourceName);
-
- // Get input stream from jar resource
- InputStream inputStream = resource.openStream();
+ try {
+ // Get the resource
+ URL resource =
LibraryLoader.class.getResource(resourceName);
- // Copy resource to filesystem in a temp folder with a
unique name
- File temporaryLib =
File.createTempFile(libraryNameWithPrefixAndArch, ".tmp");
-
- // Delete on exit the dll
- temporaryLib.deleteOnExit();
-
- FileOutputStream outputStream = new
FileOutputStream(temporaryLib);
- byte[] array = new byte[2048];
- int read = 0;
- while((read = inputStream.read(array)) > 0) {
- outputStream.write(array, 0, read);
+ // Get input stream from jar resource
+ InputStream inputStream = resource.openStream();
+
+ // Copy resource to filesystem in a temp folder
with a unique name
+ File temporaryLib =
File.createTempFile(libraryNameWithPrefixAndArch, ".tmp");
+
+ // Delete on exit the dll
+ temporaryLib.deleteOnExit();
+
+ FileOutputStream outputStream = new
FileOutputStream(temporaryLib);
+ byte[] array = new byte[2048];
+ int read = 0;
+ while((read = inputStream.read(array)) > 0) {
+ outputStream.write(array, 0, read);
+ }
+ outputStream.close();
+
+ // Finally, load the dll
+ System.out.println("Attempting to load the
"+libraryName+" library ["+resource+']');
+ System.load(temporaryLib.getPath());
+ } catch(Throwable e) {
+ e.printStackTrace();
}
- outputStream.close();
-
- // Finally, load the dll
- System.out.println("Attempting to load the
"+libraryName+" library ["+resource+']');
- System.load(temporaryLib.getPath());
- } catch(Throwable e) {
- e.printStackTrace();
}
- }
}
}