so I was wondering if anyone knew how I would go about reading in mutliple values from a key, delimiting them by commas and storing them to an arraylist from a properties file in java?
I have a properties file with just this in it:
currentProposalsLocation = C:/Documents and Settings/Intern Project/Extracted Items
keywordsList = "A,B,C,D,E,F"
And this is my code to load the properties file:
static String proposalsDirectory;
static ArrayList<String> keywordsList = new ArrayList<String>();
private static final String PROP_FILE="C:/Documents and Settings/Intern Project/ipConfig.properties";
public static void readPropertiesFile()
{
try
{
InputStream is = XMLTagParser.class.getResourceAsStream(PROP_FILE);
Properties prop = new Properties();
prop.load(is);
proposalsDirectory = prop.getProperty("currentProposalsLocation");
//?????What to do here????
is.close();
}
catch(Exception e)
{
System.out.println("Failed to read from " + PROP_FILE + " file.");
}
}
If anyone could help me out, I'd really appreciate it.
keywordsList.addAll(Arrays.asList(prop.getProperty("keywordsList").split(","));
Should work.