List of usage examples for java.util Properties load
public synchronized void load(InputStream inStream) throws IOException
From source file:Load.java
public static void main(String args[]) throws Exception { Properties p = new Properties(); p.load(new FileInputStream("colon.txt")); p.getProperty("foo"); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { Properties p = new Properties(); p.load(new FileInputStream("test.txt")); p.list(System.out);//from w w w. ja v a 2s .c om }
From source file:Main.java
public static void main(String args[]) throws Exception { Properties p = new Properties(); p.load(new FileInputStream("test.txt")); p.store(new FileOutputStream("t.txt"), "no comments"); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { Properties p = new Properties(); p.load(new FileInputStream("colon.txt")); p.list(System.out);//from ww w.ja v a 2 s .c o m }
From source file:Main.java
public static void main(String[] args) throws Exception { Properties config = new Properties(); config.load(new FileInputStream("conf-file.pros")); Enumeration en = config.keys(); while (en.hasMoreElements()) { String key = (String) en.nextElement(); System.out.println(key + ":" + config.get(key)); }/* ww w. ja v a2s. co m*/ }
From source file:MainClass.java
public static void main(String args[]) throws Exception { Properties p = new Properties(); p.load(new FileInputStream("test.txt")); Enumeration e = p.propertyNames(); for (; e.hasMoreElements();) { System.out.println(e.nextElement()); }// w ww . j a v a2s.c o m }
From source file:Main.java
public static void main(String[] argv) throws Exception { Properties properties = new Properties(); try {/*from w w w .ja va 2 s.c o m*/ properties.load(new FileInputStream("filename.properties")); } catch (IOException e) { } String string = properties.getProperty("a.b"); properties.setProperty("a.b", "new value"); }
From source file:com.googlecode.dex2jar.bin_gen.BinGen.java
/** * @param args/*from www . ja v a2 s.c o m*/ * @throws IOException */ public static void main(String[] args) throws IOException { Properties p = new Properties(); p.load(BinGen.class.getResourceAsStream("class.cfg")); String bat = FileUtils.readFileToString( new File("src/main/resources/com/googlecode/dex2jar/bin_gen/bat_template"), "UTF-8"); String sh = FileUtils.readFileToString( new File("src/main/resources/com/googlecode/dex2jar/bin_gen/sh_template"), "UTF-8"); File binDir = new File("src/main/bin"); String setclasspath = FileUtils.readFileToString( new File("src/main/resources/com/googlecode/dex2jar/bin_gen/setclasspath.bat"), "UTF-8"); FileUtils.writeStringToFile(new File(binDir, "setclasspath.bat"), setclasspath, "UTF-8"); for (Object key : p.keySet()) { String name = key.toString(); FileUtils.writeStringToFile(new File(binDir, key.toString() + ".sh"), sh.replaceAll("__@class_name@__", p.getProperty(name)), "UTF-8"); FileUtils.writeStringToFile(new File(binDir, key.toString() + ".bat"), bat.replaceAll("__@class_name@__", p.getProperty(name)), "UTF-8"); } }
From source file:JDOCreateDataStore.java
public static void main(String[] args) throws IOException { Properties p = new Properties(); p.load(new FileInputStream("jdo.properties")); p.setProperty("com.sun.jdori.option.ConnectionCreate", "true"); PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(p); PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction(); tx.begin();//ww w . ja v a 2 s .co m tx.commit(); }
From source file:Main.java
public static void main(String args[]) throws Exception { Properties props = new Properties(); URL url = ClassLoader.getSystemResource("props.properties"); props.load(url.openStream()); System.out.println("prop1 :\n " + props.get("prop1")); System.out.println("prop2 :\n " + props.get("prop2")); }