当前位置:网站首页>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: 可以查看是哪个程序使用端口
结语
大佬请留步
既然看到这了不如点个赞再走吧
本文目的在于分享技术以及在学习过程中个人记得需要注意的点,记录学习过程;
如果出现错误欢迎大家指正,如有意见或建议欢迎在评论区讨论
边栏推荐
猜你喜欢

小程序毕设作品之微信积分商城小程序毕业设计成品(1)开发概要

AI智能安防视频平台EasyCVR如何配置音视频同时传输?

Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (3) Background Functions

为什么突然间麒麟 9000 5G 版本,又有库存了?

Organizations Going Online: A New Trend in Organizational Digital Transformation

Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Products (6) Question Opening and Defense PPT

Wechat second-hand transaction small program graduation design finished product (1) Development overview

(redistribute, special comprehensive experiment ospf area)

进程优先级 nice

小程序毕设作品之微信积分商城小程序毕业设计成品(7)中期检查报告
随机推荐
为什么突然间麒麟 9000 5G 版本,又有库存了?
Boutique: Taobao/Tmall Get Order Details API for Purchased Products
OpenFeign实现负载均衡
Nacos 安装与部署
传统项目转型
cv2.polylines
vscode 调试和远程
小程序毕设作品之微信积分商城小程序毕业设计成品(7)中期检查报告
Organizations Going Online: A New Trend in Organizational Digital Transformation
spicy(二)unit hooks
day10--在Linux上安装mysql
论坛管理系统
route filter
(六)《数电》——二极管与CMOS门电路(入门)
The difference between BGP room and ordinary room in Beijing
Operational configuration: How to run multiple EasyCVR programs as a service in one server?
SQL 入门之第一讲——MySQL 8.0.29安装教程(windows 64位)
Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Products (6) Question Opening and Defense PPT
写给技术人的管理入门知识1:什么是管理
How to solve the error "no such file or directory" when EasyCVR starts?
既然看到这了不如点个赞再走吧