Package com.mku.salmon.drive
Class JavaDrive
java.lang.Object
com.mku.file.VirtualDrive
com.mku.salmon.SalmonDrive
com.mku.salmon.drive.JavaDrive
SalmonDrive implementation for standard Java file API. This provides a virtual drive implementation
that you can use to store and access encrypted files.
Use static methods open() or create() to create an instance.
-
Method Summary
Modifier and TypeMethodDescriptionstatic SalmonDrive
create
(IRealFile dir, String password, INonceSequencer sequencer) Helper method that creates and initializes a JavaDriveGet a private dir for sharing files with external applications.getRoot()
Return the virtual root directory of the drive.void
When authentication succeeds.void
When authentication succeed.static SalmonDrive
open
(IRealFile dir, String password, INonceSequencer sequencer) Helper method that opens and initializes a JavaDriveMethods inherited from class com.mku.salmon.SalmonDrive
close, createDrive, getAuthConfigFilename, getAuthId, getBytesFromRealFile, getConfigFilename, getDefaultAuthConfigFilename, getDefaultFileChunkSize, getDriveConfig, getDriveId, getExportDir, getExportDirectoryName, getKey, getRealRoot, getSequencer, getShareDirectoryName, getVirtualDriveDirectoryName, hasConfig, initFS, initialize, openDrive, revokeAuthorization, setAuthConfigFilename, setConfigFilename, setDefaultFileChunkSize, setExportDirectoryName, setPassword, setSequencer, setShareDirectoryName, setVirtualDriveDirectoryName
-
Method Details
-
open
public static SalmonDrive open(IRealFile dir, String password, INonceSequencer sequencer) throws IOException Helper method that opens and initializes a JavaDrive- 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 SalmonDrive create(IRealFile dir, String password, INonceSequencer sequencer) throws IOException Helper method that creates and initializes a JavaDrive- 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
Get a private dir for sharing files with external applications.- Specified by:
getPrivateDir
in classVirtualDrive
- Returns:
- The private directory
- Throws:
Exception
- Thrown if error occurs
-
onUnlockSuccess
public void onUnlockSuccess()When authentication succeed.- Specified by:
onUnlockSuccess
in classVirtualDrive
-
onUnlockError
public void onUnlockError()When authentication succeeds.- Specified by:
onUnlockError
in classVirtualDrive
-
getRoot
Description copied from class:SalmonDrive
Return the virtual root directory of the drive.- Overrides:
getRoot
in classSalmonDrive
- Returns:
- The virtual root directory of the drive
-