Class NativeLoader


  • public class NativeLoader
    extends java.lang.Object
    Manages the loading of the swoval-files0 library. This library provides the native implementation of FileTreeView. On OSX, it also provides a native interface to the apple file system api. The loader will first try to load the library using System.loadLibrary, which will succeed if the library is present in the (DY)LD_LIBRARY_PATH. Otherwise the loader extracts the packaged library (.so, .dll or .dylib) to a temporary directory and loads it from there. On jvm shutdown, it marks the extracted library for deletion. It will generally be deleted the next time a different jvm loads the library.

    This class is not intended to be used outside of com.swoval.files, but it doesn't belong in that package, so it has to be public here.

    • Constructor Summary

      Constructors 
      Constructor Description
      NativeLoader()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void loadPackaged()
      Loads the swoval-files0 shared library.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NativeLoader

        public NativeLoader()
    • Method Detail

      • loadPackaged

        public static void loadPackaged()
                                 throws java.io.IOException,
                                        java.lang.UnsatisfiedLinkError
        Loads the swoval-files0 shared library. It will first try to load the library from the system library path and fallback to extracting a platform-specific jar to a temporary directory.
        Throws:
        java.io.IOException - if the packaged native binary cannot be written to a temp directory.
        java.lang.UnsatisfiedLinkError - if no compatible binary for the platform is present.