java.lang.Object
org.cryptomator.frontend.dokany.adapter.OpenHandleFactory
All Implemented Interfaces:
AutoCloseable

public class OpenHandleFactory extends Object implements AutoCloseable
  • Constructor Details

    • OpenHandleFactory

      public OpenHandleFactory()
  • Method Details

    • openDir

      public long openDir(Path path) throws IOException
      Parameters:
      path -
      Returns:
      Throws:
      IOException
    • openFile

      public long openFile(Path path, OpenOption... options) throws IOException
      Parameters:
      path - path of the file to open
      options - file open options
      Returns:
      file handle used to identify and close open files.
      Throws:
      IOException
    • openFile

      public long openFile(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
      Creates an OpenFile with the given path and options & attributes and assigns a fileHandle != 0 to it
      Parameters:
      path - path of the file to open
      options - file open options
      attrs - file attributes to set when opening
      Returns:
      file handle used to identify and close open files.
      Throws:
      IOException
    • openRestrictedFile

      public long openRestrictedFile(Path path)
      Creates an OpenRestrictedFile with the given path and assigns a fileHandle != 0 to it.
      Parameters:
      path - path of the file to open
      Returns:
      file handle used to identify and close open files.
      Throws:
      IOException
    • get

      public OpenHandle get(Long fileHandle)
    • exists

      public boolean exists(Long handle)
    • close

      public void close(long handle) throws ClosedChannelException, IOException
      Closes the channel identified by the given fileHandle
      Parameters:
      handle - file handle used to identify
      Throws:
      ClosedChannelException - If no channel for the given fileHandle has been found.
      IOException
    • close

      public void close() throws IOException
      Closes all currently open files. Calling this method will not prevent the factory to open new files, i.e. this method can be called multiple times and is not idempotent.
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • areNoHandlesOpen

      public boolean areNoHandlesOpen()