Class FileValidator
java.lang.Object
co.ankatech.ankasecure.sdk.internal.util.FileValidator
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidEnsures thatpathexists, is a regular file and is readable.static voidEnsures that the parent directory ofpathexists and that the file can be created or overwritten.
-
Method Details
-
ensureReadable
public static void ensureReadable(Path path, String label, Map<String, String> ctx) throws AnkaSecureSdkExceptionEnsures thatpathexists, is a regular file and is readable.- Parameters:
path- path to validatelabel- descriptive label used in the failure messagectx- 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) throws AnkaSecureSdkExceptionEnsures that the parent directory ofpathexists and that the file can be created or overwritten.- Parameters:
path- target filelabel- descriptive label used in the failure messagectx- immutable context propagated to the SDK exception- Throws:
AnkaSecureSdkException- if the file cannot be created/written
-