Unmarshall Java Beans from Ini.Section.

This sample program expect the .ini file as a command line argument. If there is no such argument, it use the dwarfs.ini file.

Source code for beans: Dwarf, DwarfBean

import org.ini4j.Ini;


public class ToSample
    public static final String FILENAME = "dwarfs.ini";

    public static void main(String[] args) throws Exception
        String filename = (args.length > 0) ? args[0] : FILENAME;
        Ini ini = new Ini(new FileInputStream(filename));
        DwarfBean happy = new DwarfBean();

        System.out.println("Happy's age: " + happy.getAge());
        System.out.println("Happy's homePage: " + happy.getHomePage());

Standard output:

Happy's age: 99
Happy's homePage: http://happy.smurf