Showing posts with label Property (map). Show all posts
Showing posts with label Property (map). Show all posts

Saturday, 28 May 2011

Property class example in java

Here is an example of reading in a properties file, removing the password and printing out the reminder.
import java.util.*;
import java.io.*;

public class PropertyDemo {

public static void main(String[] args)
throws Exception {

BufferedInputStream bStream = new BufferedInputStream
(new FileInputStream("prefs.ini"));
Properties props = new Properties();
props.load(bStream);
props.remove("password");
props.list(System.out);
bStream.close();
}
}