Properties集合_list方法与store方法
Properties集合和流对象结合的功能
list()方法:
import java.util.Properties;
public class PropertiesDemo {
public static void main(String[] args) {
propertiesDemo();
}
public static void propertiesDemo() {
Properties prop = new Properties();
prop.setProperty("02", "huangjianfeng");
prop.setProperty("03", "jianfeng");
prop.setProperty("04", "feng");
prop.list(System.out);//该方法多用于调式,开发中很少用
}
}
store()方法:
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties; public class PropertiesDemo {
public static void main(String[] args) throws IOException {
propertiesDemo();
} public static void propertiesDemo() throws IOException {
Properties prop = new Properties();
prop.setProperty("02", "hujianfeng");
prop.setProperty("03", "jianfeng");
prop.setProperty("04", "feng"); //想要将这个集合中的字符串键值信息持久化存储到文件中,需要关联输出流
FileOutputStream fos = new FileOutputStream("F:\\info.txt"); //将集合中的数据存储到文件中,使用store方法
prop.store(fos, "number+name");//第二个参数表示对这个表的描述,也就是说说明这个表是什么
fos.close();
} }
Properties集合_list方法与store方法的更多相关文章
- Properties集合中的方法store和Properties集合中的方法load
Properties集合中的方法store public class Demo01Properties { public static void main(String[] args) throws ...
- 使用Properties集合存储数据,遍历取出Properties集合中的数据和Properties集合中的方法store和load
package com.yang.Test.PropertiesStudy; import java.io.FileWriter; import java.io.IOException; import ...
- java的缓冲流及使用Properties集合存取数据(遍历,store,load)
缓冲流 概述 字节缓冲流:BufferedInputStream,BufferedOutputStream 字符缓冲流:BufferedReader,BufferedWriter 缓冲流原理 缓冲区是 ...
- C#中对象,字符串,dataTable、DataReader、DataSet,对象集合转换成Json字符串方法。
C#中对象,字符串,dataTable.DataReader.DataSet,对象集合转换成Json字符串方法. public class ConvertJson { #region 私有方法 /// ...
- Collection中list集合的应用常见的方法
集合 : 用存放对象的容器(集合) Collection : 跟接口 : 单列集合 ---> List :有序的 ,元素是可以重复的. ---> ...
- Map集合遍历的2种方法
Map是一个集合的接口,是key-value相映射的集合接口,集合遍历的话,需要通过Iterator迭代器来进行. Iterator是什么东西: java.util包下的一个接口: 对 collect ...
- 安装PHP过程中,make步骤报错:(集合网络上各种解决方法)
安装PHP过程中,make步骤报错:(集合网络上各种解决方法) (1)-liconv -o sapi/fpm/php-fpm /usr/bin/ld: cannot find -liconv coll ...
- JAVA8 Stream集合操作:中间方法和完结方法
StreamLambda为java8带了闭包,这一特性在集合操作中尤为重要:java8中支持对集合对象的stream进行函数式操作,此外,stream api也被集成进了collection api, ...
- 从集合中查找最值得方法——max(),min(),nlargest(),nsmallest()
从集合中查找最值得方法有很多,常用的方法有max(),min(),nlargest(),nsmallest()等. 一.max()和min() 1.1 入门用法 直接使用max(),min(),返回可 ...
随机推荐
- 当Elasticsearch遇见Kafka
欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 本文由michelmu发表于云+社区专栏 Elasticsearch作为当前主流的全文检索引擎,除了强大的全文检索能力和高扩展性之外,对多种 ...
- SpringBoot(4) SpringBoot热部署
热部署,就是在应用正在运行的时候升级软件,却不需要重新启动应用. 使用springboot结合dev-tool工具,快速加载启动应用 官方地址:https://docs.spring.io/sprin ...
- C#基础知识汇总(不断更新中)
------------------------------目录---------------------------- 1.隐式类型2.匿名类型3.自动属性4.初始化器5.委托6.泛型7.泛型委托8 ...
- [转]Angular2-组件间数据传递的两种方式
本文转自:https://www.cnblogs.com/longhx/p/6960288.html Angular2组件间数据传递有多种方式,其中最常用的有两种,一种是配置元数据(或者标签装饰),一 ...
- jQuery基础教程
1.使用$()函数 $()函数其实是创建了一个jQuery对象. 这个函数接受CSS选择符作为参数,充当一个工厂, 返回包含页面中对应元素的jQuery对象. 所有能在样式表中使用的选择符都可以传给这 ...
- 【esayui】扩展验证方法,控件验证
基础验证 //页面调用方法$.extend($.fn.validatebox.defaults.rules, { 验证电话 IsPhoneRex: {validator: function (valu ...
- PHP FastCGI进程管理器PHP-FPM的架构
一个master进程,支持多个pool,每个pool由master进程监听不同的端口,pool中有多个worker进程.每个worker进程都内置PHP解释器,并且进程常驻后台,支持prefork动态 ...
- Java - BlockingQueue
https://juejin.im/post/5aeebd02518825672f19c546 https://www.infoq.cn/article/java-blocking-queue blo ...
- C# Skip和Take的简单用法
- Ashampoo Driver Updater - 阿香婆驱动安装
Ashampoo Driver Updater 让系统更完美 – 永远有最新的驱动,出错或旧的驱动是每个电脑系统的恶梦.时不时,驱动会丢失或不可避免的过时.Ashampoo Driver Update ...