/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.nplusc.izc.tools.IOtools;

import java.io.File;
import java.io.IOException;
import org.ini4j.Ini;
import org.ini4j.InvalidFileFormatException;
import org.ini4j.Profile.Section;

/**
 *
 * @author LH
 */
public class IniIface
{
    private Ini ifile;
    private File f;
    public IniIface(String path)
    {
        try
        {
            f = new File(path);
            f.createNewFile();
            ifile = new Ini(f);
        }
        catch (IOException ex)
        {
            ex.printStackTrace();
        }
    }
    
    public void writeEntry(String section,String key, String value)
    {
        ifile.add(section, key, value);
    }
    public void flush()
    {
        try
        {
            ifile.store();
        }
        catch (IOException ex)
        {
            ex.printStackTrace();
        }
    }
    
    public String readEntry(String Section,String key)
    {
        return ifile.get(Section, key)+"";
    }
}
