Reads a config file at the specified path. If the path starts with file:,
it will be read from the filesystem. Otherwise it will be loaded from the
classpath.

@param path
the configuration path
@return the configuration properties
761793
protected Properties readConfigFile(String path) {
		Properties props = new Properties();
		// Load properties file
		InputStream is = null;
		try {
			if (path.startsWith(FILE_PREFIX)) {
				if (LOGGER.isDebugEnabled() && !checking)
					LOGGER.debug("Using filesystem properties file location at: " + configLocation);
				is = new FileInputStream(new File(path.substring(FILE_PREFIX.length())));
			} else {
				if (LOGGER.isDebugEnabled() && !checking)
					LOGGER.debug("Reading properties from file at classpath: " + configLocation);
				is = ClassLoaderResourceUtils.getResourceAsStream(path, this);
			}
			loadConfig(props, path, is);

		} catch (IOException e) {
			throw new IllegalArgumentException("jawr configuration could not be found at " + path
					+ ". Make sure parameter is properly set " + "in web.xml. ");
		} finally {
			IOUtils.close(is);
		}

		return props;
	}
1252451
private Properties readPropertyFile(String file) throws IOException {
        String fileName = file.startsWith("/") ? file : "/" + file;
        LOGGER.info("Reading properties from: " + fileName + ". Will try classpath, then file system.");
        return Util.readProperties(fileName);
    }
552707
private String readFile(String path) {

        String result = (String)CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().getCachedObject(m_cms, path);
        if (result == null) {
            try {
                CmsFile file = m_cms.readFile(path);
                result = getContentAsString(file);
            } catch (CmsException e) {
                throw new RuntimeException(e);
            }
        }
        if (result != null) {
            CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().putCachedObject(m_cms, path, result);
        }
        return result;

    }
1311824
@NotNull
    public static FileInfo forPath(Path path) {
        try {
            final BasicFileAttributes attributes = Files.readAttributes(path, BasicFileAttributes.class);
            return FileInfo.builder()
                    .path(path)
                    .key(attributes.fileKey())
                    .size(attributes.size())
                    .modificationTime(attributes.lastModifiedTime())
                    .build();
        } catch (Exception e) {
            LOG.error("Couldn't get file info for path: {}", path, e);
            return EMPTY_FILE_INFO.toBuilder().path(path).build();
        }
    }
690712
public function readConfig($path)
    {
        $jsonFile = new JsonFile($path);
        $config = $jsonFile->exists() ? $jsonFile->read() : [];
        foreach ($this->dependencies as $key) {
            if (!isset($config[$key])) {
                $config[$key] = [];
            }
        }
        return $config;
    }
182971
protected static Properties loadConfig(File file) {
    InputStream is = null;
    try {
      is = new FileInputStream(file);
      return loadConfig(file.getAbsolutePath(), is);     
    } catch (Exception ex) {
      throw new IllegalArgumentException("Failed to load configuration from [" + file.getAbsolutePath() + "]");
    }finally {
      if(is!=null) try { is.close(); } catch (Exception ex) { /* No Op */ }
    }
  }
8697
public static String readString(String path, Charset charset) throws IORuntimeException {
		return readString(file(path), charset);
	}
114000
@Nullable
  public static Properties loadPropertiesFromFile(String filePath) {
    try (FileInputStream fileInputStream = new FileInputStream(filePath)) {
      return loadProperties(fileInputStream);
    } catch (FileNotFoundException e) {
      return null;
    } catch (IOException e) {
      LOG.warn("Failed to close property input stream from {}: {}", filePath, e.toString());
      return null;
    }
  }
46090
public PropertyPath parse(final String path) {
        
        ArgUtils.notEmpty(path, "path");
        
        final PropertyPath tokenStore = new PropertyPath(path);
        splitToken(tokenStore, path);
        return tokenStore;
    }
682732
function loadFile(path) {
    if ( config.asReference && config.asReference.loadFile ) {
      return config.asReference.loadFile( path );
    } else if (typeof process !== "undefined" && process.versions && !!process.versions.node && require.nodeRequire) {
      var fs = require.nodeRequire('fs');
      var file = fs.readFileSync(path, 'utf8');
      if (file.indexOf('\uFEFF') === 0)
        return file.substring(1);
      return file;
    }
    else {
      var file = new java.io.File(path),
        lineSeparator = java.lang.System.getProperty("line.separator"),
        input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), 'utf-8')),
        stringBuffer, line;
      try {
        stringBuffer = new java.lang.StringBuffer();
        line = input.readLine();
        if (line && line.length() && line.charAt(0) === 0xfeff)
          line = line.substring(1);
        stringBuffer.append(line);
        while ((line = input.readLine()) !== null) {
          stringBuffer.append(lineSeparator).append(line);
        }
        return String(stringBuffer.toString());
      }
      finally {
        input.close();
      }
    }
  }
14393
public void loadModel(String path) {
        Config cfg = Config.newConfig(path);

        loadSection(this, cfg, "r");
        loadSection(this, cfg, "p");
        loadSection(this, cfg, "e");
        loadSection(this, cfg, "m");

        loadSection(this, cfg, "g");
    }
731849
public Boolean storePropertiesFile(String path) throws IOException
    {
        Properties prop = new Properties();
        OutputStream output = null;

        try {

            output = new FileOutputStream(path);
            for (String key : configs.keySet()){
                prop.setProperty(key, configs.get(key));
            }
            prop.store(output, null);

            return true;
        } catch (IOException io) {
            return false;
        }
    }
568103
public Properties getPropertiesByContext(ServletContext context, String path) {   

    return reader.getProperties(context, path, log);
  }
666820
public static Properties loadProperties(final String path) {

        if (path != null) {
            // try as file
            try {
                File file = new File(path);
                if (file.exists()) {
                    try {
                        Properties p = new Properties();
                        p.load(new FileInputStream(file));
                        return p;
                    } catch (Exception e) {
                        log.error("Error loading properties from file: " + path);
                    }
                }
            } catch (Throwable e) {
                log.debug(e.getMessage(), e);
            }

            // try as resource
            InputStream inputStream = null;
            try {
                inputStream = PropertyUtil.class.getResourceAsStream(path);
                if (inputStream != null) {
                    try {
                        Properties p = new Properties();
                        p.load(inputStream);
                        return p;
                    } catch (Exception e) {
                        log.error("Error loading properties from resource: " + path);
                    }
                }
            } catch (Exception e) {
                log.error("Error loading properties from resource: " + path);
            } finally {
                if (inputStream != null) {
                    try {
                        inputStream.close();
                    } catch (Throwable t) {
                        log.debug("Error closing: " + path, t);
                    }
                }
            }
        }


        // return empty Properties by default
        return new Properties();
    }
271792
public static Properties loadProperties(String filePath) throws MnoConfigurationException {
		Properties properties = new Properties();
		InputStream input = getInputStreamFromClassPathOrFile(filePath);
		try {
			properties.load(input);
		} catch (IOException e) {
			throw new MnoConfigurationException("Could not load properties file: " + filePath, e);
		} finally {
			IOUtils.closeQuietly(input);
		}
		return properties;
	}
232618
public static String readResource(String path) {
        final long start = System.nanoTime();
        try (InputStream is = UScale.class.getClassLoader().getResourceAsStream(path);) {
            int len = 0;
            byte[] buffer = new byte[2048];
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            while ((len = is.read(buffer)) >= 0) {
                baos.write(buffer, 0, len);
            }
            return new String(baos.toByteArray(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            LOGGER.log(Level.WARNING, e, () -> "IOException loading resource " + path);
            throw new IllegalStateException("Unable to read class loaded stream " + path, e);
        } catch (RuntimeException re) {
            LOGGER.log(Level.WARNING, re, () -> "Unexpected exception loading resource " + path);
            throw re;
        } finally {
            LOGGER.fine(() -> String.format("Loaded resource %s in %.3fms", path,
                    (System.nanoTime() - start) / 1000000.0));
        }
    }
815775
protected static Configuration getConfig(String path) {
		if (cfg == null) {
			cfg = new Configuration();
			cfg.setClassForTemplateLoading(TemplateUtil.class, path == null ? "/templates" : path);
			cfg.setLocale(Locale.US);
			cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
		}
		return cfg;
	}