Class FileSystemCapabilityChecker

java.lang.Object
org.cryptomator.cryptofs.common.FileSystemCapabilityChecker

@Singleton public class FileSystemCapabilityChecker extends Object
  • Constructor Details

    • FileSystemCapabilityChecker

      @Inject public FileSystemCapabilityChecker()
  • Method Details

    • assertAllCapabilities

      public void assertAllCapabilities(Path pathToVault) throws FileSystemCapabilityChecker.MissingCapabilityException
      Checks whether the underlying filesystem has all required capabilities.
      Implementation Note:
      Only short-running tests with constant time are performed
      Parameters:
      pathToVault - Path to a vault's storage location
      Throws:
      FileSystemCapabilityChecker.MissingCapabilityException - if any check fails
      Since:
      1.9.2
    • assertReadAccess

      public void assertReadAccess(Path pathToVault) throws FileSystemCapabilityChecker.MissingCapabilityException
      Checks whether the underlying filesystem allows reading the given dir.
      Parameters:
      pathToVault - Path to a vault's storage location
      Throws:
      FileSystemCapabilityChecker.MissingCapabilityException - if the check fails
      Since:
      1.9.3
    • assertWriteAccess

      public void assertWriteAccess(Path pathToVault) throws FileSystemCapabilityChecker.MissingCapabilityException
      Checks whether the underlying filesystem allows writing to the given dir.
      Parameters:
      pathToVault - Path to a vault's storage location
      Throws:
      FileSystemCapabilityChecker.MissingCapabilityException - if the check fails
      Since:
      1.9.3
    • determineSupportedCleartextFileNameLength

      public int determineSupportedCleartextFileNameLength(Path pathToVault) throws IOException
      Throws:
      IOException
    • determineSupportedCiphertextFileNameLength

      public int determineSupportedCiphertextFileNameLength(Path pathToVault) throws IOException
      Determinse the number of chars a ciphertext filename (including its extension) is allowed to have inside a vault's d/XX/YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY/ directory.
      Parameters:
      pathToVault - Path to the vault
      Returns:
      Number of chars a .c9r file is allowed to have
      Throws:
      IOException - If unable to perform this check
    • determineSupportedCiphertextFileNameLength

      public int determineSupportedCiphertextFileNameLength(Path dir, int subPathLength, int minFileNameLength, int maxFileNameLength) throws IOException
      Determines the number of chars a filename is allowed to have inside of subdirectories of dir by running an experiment.
      Parameters:
      dir - Path to a directory where to conduct the experiment (e.g. /path/to/vault/c)
      subPathLength - Defines the combined number of chars of the subdirectories inside dir, including slashes but excluding the leading slash. Must be a minimum of 6
      minFileNameLength - The minimum filename length to check
      maxFileNameLength - The maximum filename length to check
      Returns:
      The supported filename length inside a subdirectory of dir with subPathLength chars
      Throws:
      IOException - If unable to perform this check