Java BufferedReader Read loadConfigProps(String configFile)

Here you can find the source of loadConfigProps(String configFile)

Description

load Config Props

License

Apache License

Declaration

public static void loadConfigProps(String configFile) throws FileNotFoundException, IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.BufferedReader;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import java.io.IOException;

import java.io.InputStreamReader;

import java.util.HashMap;

public class Main {
    private static HashMap<String, String> configProps = new HashMap<String, String>();

    public static void loadConfigProps(String configFile) throws FileNotFoundException, IOException {
        // open up the config file and get the remaining parms
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(configFile)));

        try {//from w ww  . jav  a2s  .c om
            String line;
            while ((line = br.readLine()) != null) {
                String[] strArray = line.split("=");
                if (strArray.length != 2)
                    continue;
                String prop = strArray[0];
                String val = strArray[1];
                configProps.put(prop, val);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            br.close();
        }
    }
}

Related

  1. loadByUsingSplit(String filename)
  2. loadClob(File f, String enc)
  3. loadCommonMisspellingsFile(String commonMisspellingsFileLocation)
  4. loadConfFile(String filename, String key)
  5. loadConfig(File conf)
  6. loadContents(File file)
  7. loadCredentials(File credentials)
  8. loadCsvFile(String fileWithPath, String delimiter)
  9. loadDataURLs(File f, Pattern p)