码迷,mamicode.com
首页 > 编程语言 > 详细

万用工具包hutool-使用java获取文件地址,并读取其中的文件内容

时间:2020-05-26 12:39:35      阅读:324      评论:0      收藏:0      [点我收藏+]

标签:url   jdb   函数   artifact   获取文件   depend   har   配置   tool   

场景:单纯打jar包时输入json参数必须是转义过的,很麻烦,直接从文件中读取不需要手动转义

 

1、加入pom文件

<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.3.5</version>
</dependency>

2、配置setting文件,如(同理,也可以这么配置jdbc信息)

技术图片

 

 

 

3、main函数下加入

Setting setting = new Setting(new File(fileUrl), CharsetUtil.CHARSET_UTF_8, true);//fileUrl是对应文件的具体地址,如E:/code/f.setting
String uripush=setting.getStr("sendtype");//获取配置文件中的具体参数内容
String json111=setting.getStr("input");




万用工具包hutool-使用java获取文件地址,并读取其中的文件内容

标签:url   jdb   函数   artifact   获取文件   depend   har   配置   tool   

原文地址:https://www.cnblogs.com/Codingdoudou/p/12964418.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!