java.lang.Object
org.cryptomator.frontend.dokany.internal.DokanyMount
All Implemented Interfaces:
AutoCloseable

public final class DokanyMount extends Object implements AutoCloseable
Main class to start and stop Dokany file system.
  • Constructor Details

  • Method Details

    • getDriverVersion

      public static long getDriverVersion()
      Get driver version.
      Returns:
    • getVersion

      public static long getVersion()
      Get Dokany version.
      Returns:
    • mount

      public void mount() throws DokanyException
      Calls NativeMethods.DokanMain(DeviceOptions, DokanyOperations) in a new thread. No-op if this object is already mounted.

      Additionally a shutdown hook invoking close() is registered to the JVM.

      Throws:
      DokanyException
    • mount

      public void mount(Consumer<Throwable> onDokanExit) throws DokanyException
      Calls NativeMethods.DokanMain(DeviceOptions, DokanyOperations) in a new thread and after DokanMain exit runs the specified action with an throwable as parameter if DokanMain terminiated irregularly. No-op if this object is already mounted.

      Additionally a shutdown hook invoking close() is registered to the JVM.

      Parameters:
      onDokanExit - object with a run() method which is executed after the Dokan process exited
      Throws:
      DokanyException
    • close

      public void close()
      Unmounts the Dokan device from its mount point. No-op if the device is not mounted.
      Specified by:
      close in interface AutoCloseable
    • unmount

      public void unmount() throws IllegalStateException
      Unmounts the filessystem, if it is safe.
      Throws:
      IllegalStateException - if it is currently not possible to unmount the filesytsem.
    • unmountForced

      public void unmountForced()
      Unmounts the filesystem, no matter what.