java.lang.Object
org.cryptomator.cryptofs.migration.Migrators

public class Migrators extends Object
Used to perform migration from an older vault format to a newer one.

Example Usage:

 
 if (Migrators.get().needsMigration(Path, String, String) needsMigration(pathToVault, vaultConfigFilename, masterkeyFileName)}) {
        Migrators.get().migrate(pathToVault, masterkeyFileName, passphrase, progressListener, continuationListener);
 }
 
 
Since:
1.4.0
  • Method Details

    • get

      public static Migrators get()
    • needsMigration

      public boolean needsMigration(Path pathToVault, String vaultConfigFilename, String masterkeyFilename) throws IOException
      Inspects the vault and checks if it is supported by this library.
      Parameters:
      pathToVault - Path to the vault's root
      vaultConfigFilename - Name of the vault config file located in the vault
      masterkeyFilename - Name of the masterkey file optionally located in the vault
      Returns:
      true if the vault at the given path is of an older format than supported by this library
      Throws:
      IOException - if an I/O error occurs parsing the masterkey file
    • migrate

      public void migrate(Path pathToVault, String vaultConfigFilename, String masterkeyFilename, CharSequence passphrase, MigrationProgressListener progressListener, MigrationContinuationListener continuationListener) throws NoApplicableMigratorException, org.cryptomator.cryptolib.api.CryptoException, IOException
      Performs the actual migration. This task may take a while and this method will block.
      Parameters:
      pathToVault - Path to the vault's root
      vaultConfigFilename - Name of the vault config file located inside pathToVault
      masterkeyFilename - Name of the masterkey file located inside pathToVault
      passphrase - The passphrase needed to unlock the vault
      progressListener - Listener that will get notified of progress updates
      continuationListener - Listener that will get asked if there are events that require feedback
      Throws:
      NoApplicableMigratorException - If the vault can not be migrated, because no migrator could be found
      org.cryptomator.cryptolib.api.InvalidPassphraseException - If the passphrase could not be used to unlock the vault
      FileSystemCapabilityChecker.MissingCapabilityException - If the underlying filesystem lacks features required to store a vault
      IOException - if an I/O error occurs migrating the vault
      org.cryptomator.cryptolib.api.CryptoException