txt文件操作

// txt文件操作
Properties prop = new Properties();
String s = "Height=200";
String s2 = "Width=15";
FileOutputStream fos = new FileOutputStream("properties.txt");
fos.write(s.getBytes());
fos.write("\r\n".getBytes());
fos.write(s2.getBytes()); FileInputStream fis = new FileInputStream("properties.txt");
prop.load(fis); // txt:从输入字节流读取
prop.list(System.out);
System.out.println(prop.get("Height"));

xml文件操作

// xml文件操作
Properties prop = new Properties();
prop.put("Height", "200");
prop.put("Width", "15");
FileOutputStream fos = new FileOutputStream("properties.xml");
prop.storeToXML(fos, "Properties Example"); // xml:输出流写入 FileInputStream fis = new FileInputStream("properties.xml");
prop.loadFromXML(fis); // xml:从输入流读取properties
prop.list(System.out); Set<String> set = prop.stringPropertyNames();
System.out.println(set)

最新文章

  1. C#调用Win32API
  2. Mybats中字符串判断
  3. CodeForces 515C. Drazil and Factorial
  4. structs2之多文件上传
  5. Javascript 基础知识学习--javascript中的参数传递都是按值传递的
  6. MVC模式的学生信息增删改查
  7. java Clone()克隆
  8. HasMap
  9. SQL AlawaysOn 之一:安装域控制器
  10. 老李分享:Mac快捷键
  11. javaWEB之Servlet
  12. Dockerfile中CMD和ENTRYPOINT的区别
  13. 微信小程序页面跳转的问题(app.json中设置tarBar后wx.redirectTo和wx.navigateTo均不能实现跳转到指定的页面)
  14. Java数据类型之byte、char
  15. 【HNOI 2017】大佬
  16. 关于C语言内存的一些理解
  17. HTML&amp;javaSkcript&amp;CSS&amp;jQuery&amp;ajax(七)
  18. Mac系统下安装PyCharm
  19. Spark简介及其在ubuntu下的安装使用
  20. IIS------如何占用80端口

热门文章

  1. Azure系列2.1.7 —— BlobRequestOptions
  2. [转帖]分布式Unique ID的生成方法一览
  3. 逻辑斯特回归tensorflow实现
  4. 【apache2】AH00543: httpd: bad user name apache
  5. Python--文件、文件夹、压缩包、处理模块shutil
  6. URL &amp; QRcode auto generator
  7. Delphi之TStrings和TStringLists类
  8. 一、Dev单元格
  9. vue-cli: preset预设
  10. Codeforces Round #539 Div. 1