Code example for Properties

Methods: get

0
import java.util.Properties; 
 
public class Location { 
 
	private static int atoi(Properties prop, String string) {
		return Integer.parseInt(prop.get(string).toString());
	} 
 
	public static Location load(File stateFile) throws IOException {
		try { 
			Properties prop = new Properties();
			FileInputStream fis = new FileInputStream(stateFile);
			prop.load(fis);
			fis.close();
 
			return new Location(prop.get("title").toString());
		} catch (Throwable t) {
			stateFile.delete();
			return null; 
		} 
	}