import java.io.*;
import java.util.Properties;
public class IniReader
{
public Properties ini = null;
public IniReader(String fileString)
{
File file=new File(fileString);
try
{
ini = new Properties ();
ini.load (new FileInputStream (file));
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
public String getIniKey (String key) {
if(!ini.containsKey (key))
{
return null;
}
return ini.get(key).toString();
}
public static void main(String[] args)
{
IniReader ini=new IniReader("D:\\sendSMS\\conn.ini");
System.out.println(ini.getIniKey("driver"));
}
}
JAVA读取ini文件(很简单不带section)
最新推荐文章于 2024-04-23 16:41:51 发布