获取项目中.txt 文件的内容
2024-09-26 21:24:42
package com.fh.controller.ruitai.util; import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream; public class TomcatUtil {
/**
* @Description 读取文件
* @author 张洋.
* @date
* @return
* @throws ExceptionFile
*/
public static String GetIdentified() throws Exception { //
File f = new File(TomcatUtil.class.getClassLoader().getResource("tomcatdentified.txt").getPath().replaceAll("%20", " "));
FileInputStream input = new FileInputStream(f);
BufferedInputStream buf = new BufferedInputStream(input);
byte[] b = new byte[(int) f.length()];
input.read(b);
input.close();
String identified=new String(b);
return identified;
}
public static void main(String[] args) {
try {
GetIdentified();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
最新文章
- paip.信用卡账单处理分类bug o21
- js设置输入框失去光标与光标选中时样式
- sh脚本学习之: sh脚本 、sed、awk
- PDO 查询mysql返回字段整型变为String型解决方法
- 为什么我要称自己为Javascript程序员
- [设计模式]<;<;设计模式之禅>;>;之关于单一职责原则
- 教程-for do、while do 中循环退出
- Help View修复
- RxJava使用场景小结
- 关于ios8斯坦福公开课第二课
- 【linux】 Makefile之make menuconfig /uImage
- RMAN duplicate from active 时遭遇 ORA-17627 ORA-12154
- scala map
- [笔记]使用Keepalived实现Nginx主从热备
- CentOS 7 实现zabbix agent 自动添加,并链接到指定的模版
- sublime快捷方式
- WordPress 本地建站
- jdbctemplate 获取数据表结构的方法&;注意事项
- vue + vue-router+vuex+elementUI开发环境搭建
- what&#39;s the 二叉树