Load properties from the given file.
481867
public static Properties loadProperties(File f) throws IOException {
        Properties props = new Properties();
        FileInputStream in = new FileInputStream(f);
        try {
            props.load(in);
            return props;
        } finally {
            try {
                in.close();
            } catch (IOException e) {
            }
        }
    }
815695
public void loadSettings(String file) throws IOException {
        Path path = Paths.get(file);

        try (BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) {
            Properties props = new Properties();
            props.load(reader);
            loadSettings(props);
        }
    }
860701
public static ParameterTool fromPropertiesFile(File file) throws IOException {
		if (!file.exists()) {
			throw new FileNotFoundException("Properties file " + file.getAbsolutePath() + " does not exist");
		}
		try (FileInputStream fis = new FileInputStream(file)) {
			return fromPropertiesFile(fis);
		}
	}
41805
public void loadFromPropertyFile() throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "loadFromPropertyFile()");

        String key        = null;
        Properties config = new Properties();
        InputStream is    = this.getClass().getResourceAsStream(PROPERTY_FILE);

        if (is == null) {
            throw new IOException("Resource " + PROPERTY_FILE + " not found in current classloader");
        }

        config.load(is);

        Enumeration vEnum = config.propertyNames();

        while (vEnum.hasMoreElements())
        {
            key = (String) vEnum.nextElement();

            if (key.equals("datasourceClassname"))
                datasourceClassname = config.getProperty(key);
            else if (key.equals("username"))
                datasourceUsername  = config.getProperty(key);
            else if (key.equals("password"))
                datasourcePassword  = config.getProperty(key);
            else if (key.equals("schemaname"))
                schemaName = config.getProperty(key);
            else if (key.equals("poolSize"))
                numberOfPooledConnections = Integer.parseInt(config.getProperty(key));
            else if (key.equals("verbose"))
                verbose = Boolean.valueOf(config.getProperty(key)).booleanValue();
            else
                datasourceProperties.setProperty(key, config.getProperty(key));
        }

        if (datasourceClassname == null)
            throw new IllegalStateException("The properties file must specify datasourceClassname");

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "loadFromPropertyFile()");
    }
450504
public static Properties readPropertiesFile( File file ) throws IOException {

		Properties result = new Properties();
		InputStream in = null;
		try {
			in = new FileInputStream( file );
			result.load( in );

		} finally {
			closeQuietly( in );
		}

		return result;
	}
1191720
private Properties loadProperties(File baseDir, Properties currentProperties, String key, boolean override) throws IOException {
        Properties loadedProperties = new Properties();

        String include = (String) currentProperties.remove(key);
        if (!StringUtils.isNullOrEmpty(include)) {
            // allow for multiples
            List<String> names = StringUtils.getList(include, DEFAULT_LIST_DELIMITER);
            for (String name : names) {
                if (StringUtils.isNullOrEmpty(name)) {
                    continue;
                }

                // interpolate any variables
                final String fileName = interpolateString(name);

                // try co-located
                File file = new File(baseDir, fileName);
                if (!file.exists()) {
                    // try absolute path
                    file = new File(fileName);
                }

                if (!file.exists()) {
                    log.warn("failed to locate {}", file);
                    continue;
                }

                // load properties
                log.debug("loading {} settings from {}", key, file);
                try (FileInputStream iis = new FileInputStream(file)) {
                    loadedProperties.load(iis);
                }

                // read nested properties
                loadedProperties = loadProperties(file.getParentFile(), loadedProperties, key, override);
            }
        }

        Properties merged = new Properties();
        if (override) {
            // "override" settings overwrite the current properties
            merged.putAll(currentProperties);
            merged.putAll(loadedProperties);
        } else {
            // "include" settings are overwritten by the current properties
            merged.putAll(loadedProperties);
            merged.putAll(currentProperties);
        }

        return merged;
    }
755070
public void load(File file, String separator) throws IOException, PropertiesException {
		try (InputStream stream = new FileInputStream(file)){
			load(stream, separator);
		}
	}
220196
public void loadPropertyFile(String file, Properties target)
  {
    try
    {
      // Use SecuritySupport class to provide priveleged access to property file
      SecuritySupport ss = SecuritySupport.getInstance();

      InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
                                              file);

      // get a buffered version
      BufferedInputStream bis = new BufferedInputStream(is);

      target.load(bis);  // and load up the property bag from this
      bis.close();  // close out after reading
    }
    catch (Exception ex)
    {
      // ex.printStackTrace();
      throw new org.apache.xml.utils.WrappedRuntimeException(ex);
    }
  }
329408
def load(self, f, line=None):
        """"""
        if line is None:
            # in case the file contains only a fragment of an input file,
            # this is useful.
            line = f.readlin()
        words = line[1:].split()
        self.__name = words[0].upper()
        self.section_parameters = " ".join(words[1:])
        try:
            self.load_children(f)
        except EOFError:
            raise FileFormatError("Unexpected end of file, section '%s' not ended." % self.__name)
1117332
private Properties loadPropertiesFile(File propertiesFile) throws MojoExecutionException { // NOSONAR
        try (FileInputStream propertiesFileInputStream = new FileInputStream(propertiesFile)) {
            Properties loadedProperties = new Properties();
            loadedProperties.load(propertiesFileInputStream);
            return loadedProperties;
        } catch (IOException e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }
1374880
public static Properties readProperties(File _file) {
        if (_file.exists()) {
            try {
                return readProperties(new FileInputStream(_file));
            } catch (FileNotFoundException _ex) {
                LOGGER.info("Could not load properties file: " + _file, _ex);
            }
        }
        return null;
    }
7073
public void load(File file) {
    try {
      PropertiesConfiguration config = new PropertiesConfiguration();
      // disabled to prevent accumulo classpath value from being shortened
      config.setDelimiterParsingDisabled(true);
      config.load(file);
      ((CompositeConfiguration) internalConfig).addConfiguration(config);
    } catch (ConfigurationException e) {
      throw new IllegalArgumentException(e);
    }
  }
342521
private void loadProperties(File propFile) {
		if (propFile == null) {
			return;
		}
		try {
			loadProperties(new FileInputStream(propFile), propFile.getAbsolutePath());
		}
		catch (FileNotFoundException e) {
			Console.warn("Unable to find properties file ["+propFile.getAbsolutePath()+"].");
		}
	}
248896
private Properties loadIncludes(File baseDir, Properties properties) throws IOException {
        return loadProperties(baseDir, properties, "include", false);
    }
874942
private void loadProperties(final String filename, final int depth) {
    logger.warning("Loading file '" + filename + "'");
    final Properties properties = new Properties();
    try {
      // Load our properties file.
      for (final InputStream io : getInputStreamsForFile(filename)) {
        properties.load(io);
        logger.info("Property file loaded successfully (" + filename + ")");
        io.close();
      }
    }
    catch (final java.io.FileNotFoundException ex) {
      logger.warning("Property file not found (" + filename + ")");
    }
    catch (final java.io.IOException ex) {
      logger.warning("IOException loading file: " + ex.getMessage());
      logger.log(Logging.Priority.FATAL.getLevel(), "Error occured while loading properties file (" + filename + ")", ex);
    }
    allProperties.putAll(properties);
    final String includeFiles[] = readIncludeFiles(filename, depth);
    for (final String includeFile : includeFiles) {
      loadProperties(includeFile, depth + 1);
    }
  }
1203441
public static Properties loadFile(File file) throws IOException {
		InputStream input = new FileInputStream(file);
		Properties prop = null;
		try {
			prop = load(input);
		} finally {
			IOUtils.close(input);
		}
		return prop;
	}
1093284
private synchronized void loadProperties()
	{
		// If multiple threads are waiting to invoke this method only allow
		// the first one to do so. The rest should just return since the first
		// thread through took care of loading the properties.
		try
		{
			
			this.file = null;
			
			boolean alwaysReload = this.isAlwaysReload();

			boolean useFormatting = this.isUseFormatting();
	
			String filePath = getSystemPropertyFile();
			if (filePath != null && filePath.length() > 0)
			{
				// System.out.println("CONFIG: LOADING CONFIG properties from "+
				// file);
				this.file = Paths.get(filePath).toFile();
				FileInputStream fis = new FileInputStream(file);

				try
				{
					properties = new Properties();
					// Load the properties object from the properties file
					properties.load(fis);
					// System.out.println("CONFIG: FINISHED LOADING CONFIG
					// properties from "+
					// file);

					configSourceLocation = file.getAbsolutePath();
				}
				catch (Exception e)
				{
					e.printStackTrace();
					throw new ConfigException(e.toString());
				}
				finally
				{
					if (fis != null)
						fis.close(); // Always close the file, even on exception

				}

			}
			else
			{
				properties = new Properties();

				try
				{
					String bundleName = getBundleName();

					// try to get properties from resource bundle
					ResourceBundle rb = ResourceBundle.getBundle(bundleName);

					URL url = Config.class.getResource(bundleName + ".properties");

					if (url != null)
						configSourceLocation = url.toString();
					else
						configSourceLocation = bundleName + ".properties";

					Enumeration<?> keys = rb.getKeys();

					Object k = null;

					while (keys.hasMoreElements())
					{

						k = keys.nextElement();

						properties.put(k, rb.getString(k + ""));

					}
				} // end els load from resource bundle
				catch (MissingResourceException e)
				{
				}
			}//end else
			
			

			//Determine global settings
			String reloadBool = properties.getProperty(Config.class.getName() + ".alwaysReload");

			if (reloadBool == null || reloadBool.length() == 0)
			{

				// throw new ConfigException("System property
				// "+Constants.ALWAY_RELOAD_PROP+" is not set.");

				alwaysReload = false;

			}
			else
			{
				alwaysReload = Boolean.valueOf(reloadBool).booleanValue();
			}

			this.setAlwaysReload(alwaysReload);

			// Merge SystemProperteis
			mergeSystemProperties = Boolean
					.valueOf(properties.getProperty(Config.class.getName() + ".mergeSystemProperties", "true"))
					.booleanValue();

			if (mergeSystemProperties)
			{
				// add system properties
				properties.putAll((Properties)System.getProperties().clone());
			}

			// Envinronment SystemProperteis
			mergeEnvProperties = Boolean
					.valueOf(properties.getProperty(Config.class.getName() + ".mergeEnvProperties", "true"))
					.booleanValue();

			if (mergeEnvProperties)
			{
				// add env properties
				properties.putAll(System.getenv());
			}

			// process formatting
			String propName = Config.class.getName() + ".useFormatting";
			String useFormattingText = properties.getProperty(propName);

			// System.out.println("CONFIG:
			// "+propName+"="+useFormattingText);

			if (useFormattingText == null || useFormattingText.length() == 0)
			{

				// throw new ConfigException("System property
				// "+Constants.ALWAY_RELOAD_PROP+" is not set.");

				useFormatting = false;

			}
			else
			{
				useFormatting = Boolean.valueOf(useFormattingText).booleanValue();
			}

			if (useFormatting)
			{
				// System.out.println("CONFIG: FORMATTING MAP CONFIG
				// properties ");
				// format map (note this can be an expensive operation)

				Text.formatMap(properties);
				// System.out.println("CONFIG: FORMATTED MAP CONFIG
				// properties ");
			}

			propName = Config.class.getName() + ".setSystemProperties";
			setSystemProperties = Boolean.valueOf(properties.getProperty(propName, "false")).booleanValue();

			// Set system properties with values from configuration
			if (setSystemProperties)
			{
				Set<Object> keySet = properties.keySet();
				String key;
				String sysProp;
				for (Iterator<Object> i = keySet.iterator(); i.hasNext();)
				{
					key = (String) i.next();
					sysProp = System.getProperty(key);

					if (sysProp != null && sysProp.length() > 0)
						continue; // do not override values

					// set system property
					System.setProperty(key, properties.getProperty(key));
				}
			}
			
			
			
		}
		catch (ConfigException e)
		{
			throw e;
		}
		catch (FileNotFoundException e)
		{
			throw new ConfigException(e.getMessage(), e);
		}
		catch (Exception e)
		{
			throw new ConfigException(e.getMessage(), e);
		}
		
		try
		{
			this.registry.notify(this.getClass().getName(), this);
		}
		catch(Exception e)
		{
			Debugger.printWarn(e);
		}
	}