当前位置:网站首页>Roperties类配置文件&DOS查看主机网络情况
Roperties类配置文件&DOS查看主机网络情况
2022-07-30 03:53:00 【Zinksl】
文章目录

个人介绍
大家好我是:一颗松
认真分享技术,记录学习点滴
如果分享对你有用请支持我哦
点赞: 留言:收藏:️
个人格言: 想法落实的最佳时机就是现在!
1 Properties类很方便操作.properties 的配置文件
1.1 Properties常用方法
方法名 | 说明 |
---|---|
load | 加载配置文件中的键值对到Properties对象中 |
list | 将数据显示到指定的设备 |
getProperties(key) | 根据键获取值 |
setProperties(key,value) | 设置键值对到Properties对象 |
store | 将Properties中的键值对存储到配置文件中,在IDEA中如果配置文件含有中文,会转为相应的Unicode编码 |
1.2 代码示例:
public class PropertiesDemo {
public static void main(String[] args) throws IOException {
// 创建Properties对象
Properties properties = new Properties();
// 加载文件
properties.load(new FileReader("E:\\Codes\\myProject\\JiShiTongXun\\propertiesDemo\\mysql.properties"));
// 传入标准输出流
properties.list(System.out);
// 获取值
String user = properties.getProperty("name");
String age = properties.getProperty("age");
System.out.println("用户名:"+user+" 年龄:"+age);
// 设置键值对,如果key存在则是修改,如果key不存在新建
properties.setProperty("name","java");
// 获取值
String user2 = properties.getProperty("name");
System.out.println("用户名:"+user2+" 年龄:"+age);
// 创建新的文件
properties.setProperty("lookMoonup","zhangjie");
// 将 K-V 存储到文件中
properties.store(new FileOutputStream("E:\\Codes\\myProject\\JiShiTongXun\\propertiesDemo\\mysqlsave.properties"),null);
System.out.println("保存成功");
}
}
2 netstat -an :查看当前主机网络情况,包括端口情况和网络连接
netstat -an | more: 分页显示
netstat -anb: 可以查看是哪个程序使用端口
结语
大佬请留步
既然看到这了不如点个赞再走吧
本文目的在于分享技术以及在学习过程中个人记得需要注意的点,记录学习过程;
如果出现错误欢迎大家指正,如有意见或建议欢迎在评论区讨论
边栏推荐
- Solve the problem of compiling and installing gdb-10.1 unistd.h:663:3: error: #error “Please include config.h first.”
- EasyNVR平台级联到EasyCVR,视频播放一会就无法播放是什么原因?
- Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Products (6) Question Opening and Defense PPT
- curl命令获取外网ip
- day10--install mysql on linux
- Wechat second-hand transaction small program graduation design finished product (1) Development overview
- 小程序毕设作品之微信二手交易小程序毕业设计成品(6)开题答辩PPT
- Nacos namespace
- 小程序毕设作品之微信二手交易小程序毕业设计成品(3)后台功能
- 对均匀采样信号进行重采样
猜你喜欢
随机推荐
CMake installation and testing
星光不问赶路人!武汉校区小姐姐三个月成功转行软件测试,收获9k+13薪!
Summary of Rpc and gRpc Introduction
After 5 years of Ali internship interview~
How does the AI intelligent security video platform EasyCVR configure the simultaneous transmission of audio and video?
What is the difference between mission, vision and values?
Smart answer function, CRMEB knowledge payment system must have!
路由过滤器
新接口——“淘特”关键词搜索的API接口
When the EasyNVR platform is cascaded to the EasyCVR, why can't the video be played after a while?
route filter
SDL player in action
Nacos集群分区
The curl command to get the network IP
TCP拥塞控制技术 与BBR的加速原理
Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (3) Background Functions
SQL Server数据类型转换函数cast()和convert()详解
智能答题功能,CRMEB知识付费系统必须有!
SQL 入门之第一讲——MySQL 8.0.29安装教程(windows 64位)
flutter 记录学习不一样的动画(二)