public static boolean doesResourceExist(final Resource res) {
        if (res == null) {
            return false;
        }
        try {
            if (res.isFile() && FileUtils.isDirectory(res.getFile())) {
                return true;
            }
            try (val input = res.getInputStream()) {
                IOUtils.read(input, new byte[1]);
                return res.contentLength() > 0;
            }
        } catch (final FileNotFoundException e) {
            LOGGER.trace(e.getMessage());
            return false;
        } catch (final Exception e) {
            LOGGER.trace(e.getMessage(), e);
            return false;
        }
    }
Does resource exist?
<p>
On Windows, reading one byte from a directory does not return length greater than zero so an explicit directory
check is needed.

@param res the res
@return true/false
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java