for ( final AccessMode mode : modes ) {
checkNotNull( "mode", mode );
switch ( mode ) {
case READ:
if ( !path.toFile().canRead() ) {
throw new AccessDeniedException( path.toString() );
}
break;
case EXECUTE:
if ( !path.toFile().canExecute() ) {
throw new AccessDeniedException( path.toString() );
}
break;
case WRITE:
if ( !path.toFile().canWrite() ) {
throw new AccessDeniedException( path.toString() );
}
break;
}
}
}