import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.Properties;
public class ReadProperties {
public void saveProperty() throws Exception {
// File file = new File("../test/src/TableViewEntityConfig.properties");
// FileOutputStream output = new FileOutputStream(file);
FileOutputStream output = new FileOutputStream(new File(
"../test/src/TableViewEntityConfig.properties"),true);
//true参数表示:在保留原来数据的基础上新增数据
Properties p = new Properties();
p.setProperty("newtest", "hello,world");
p.store(output, " ");
output.close();
}
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
ReadProperties rp = new ReadProperties();
InputStream in = new BufferedInputStream(new FileInputStream(
"../test/src/TableViewEntityConfig.properties"));
Properties p = new Properties();
p.load(in);
String s = p.getProperty("zhihualee");
System.out.print(s);
in.close();
rp.saveProperty();
}
}