public static String readYAMLConfigFile(Path filePath) throws YAMLConfigManagerException {
        if (!filePath.toFile().exists()) {
            throw new YAMLConfigManagerException("Error while initializing YAML config manager, " +
                    "YAML file does not exist with path '" + filePath.toAbsolutePath().toString() + "'.");
        }
        if (!filePath.toString().endsWith(".yaml")) {
            throw new YAMLConfigManagerException("Error while initializing YAML config manager, file extension " +
                    "'yaml' expected");
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("Initialize config provider instance from configuration file: " + filePath.toString());
        }
        try {
            return readContent(filePath);
        } catch (IOException e) {
            throw new YAMLConfigManagerException("Unable to read config file '" + filePath.toAbsolutePath().toString()
                    + "'.", e);
        }
    }
Util class to read file content
modules/siddhi-core/src/main/java/io/siddhi/core/util/FileReader.java