Class Drive


public class Drive extends AesDrive
VirtualDrive implementation for local file systems. Use to store and access encrypted files. To create an instance use static methods open() or create().
  • Constructor Details

    • Drive

      protected Drive()
      Protected constructor, use open() or create() instead.
  • Method Details

    • open

      public static AesDrive open(IFile dir, String password, INonceSequencer sequencer) throws IOException
      Helper method that opens and initializes a Drive
      Parameters:
      dir - The directory that hosts the drive.
      password - The password.
      sequencer - The nonce sequencer that will be used for encryption.
      Returns:
      The drive.
      Throws:
      IOException - Thrown if error occurs during opening the drive.
    • create

      public static AesDrive create(IFile dir, String password, INonceSequencer sequencer) throws IOException
      Helper method that creates and initializes a Drive
      Parameters:
      dir - The directory that will host the drive.
      password - The password.
      sequencer - The nonce sequencer that will be used for encryption.
      Returns:
      The drive.
      Throws:
      IOException - If error occurs during creating the drive.
    • getPrivateDir

      public IFile getPrivateDir() throws Exception
      Get a private dir for sharing files with external applications.
      Specified by:
      getPrivateDir in class VirtualDrive
      Returns:
      The private directory
      Throws:
      Exception - Thrown if error occurs
    • onUnlockSuccess

      public void onUnlockSuccess()
      Called when drive unlock succeeds.
      Specified by:
      onUnlockSuccess in class VirtualDrive
    • onUnlockError

      public void onUnlockError()
      Called when drive unlock fails.
      Specified by:
      onUnlockError in class VirtualDrive
    • getRoot

      public AesFile getRoot()
      Description copied from class: AesDrive
      Return the virtual root directory of the drive.
      Overrides:
      getRoot in class AesDrive
      Returns:
      The virtual root directory of the drive