Class FileValidator

Object
FileValidator

public final class FileValidator extends Object
  • Method Details

    • ensureReadable

      public static void ensureReadable(Path path, String label, Map<String,String> ctx)
      Ensures that path exists, is a regular file and is readable.
      Parameters:
      path - path to validate
      label - descriptive label used in the failure message
      ctx - immutable context propagated to the SDK exception
      Throws:
      AnkaSecureSdkException - if any pre-condition is not met
    • ensureWritable

      public static void ensureWritable(Path path, String label, Map<String,String> ctx)
      Ensures that the parent directory of path exists and that the file can be created or overwritten.
      Parameters:
      path - target file
      label - descriptive label used in the failure message
      ctx - immutable context propagated to the SDK exception
      Throws:
      AnkaSecureSdkException - if the file cannot be created/written