IO流5 --- FileReader读入数据的基本操作 --- 技术搬运工(尚硅谷)
2024-09-24 15:58:05
- FileReader 字符输入流
@Test
public void test1(){
File file = new File("hello.txt");
FileReader fr = null;
try {
fr = new FileReader(file);
//返回读取的内容
int data;
while ((data = fr.read()) != -1){
System.out.print((char)data);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally {
if (fr != null){
try {
fr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
最新文章
- [IOS基础]关于IOS的UIScreeen,UIView,UIViewController,UIWindow理解
- scoi2010&;&;bzoj1858序列操作
- pacman -Syu : key could not be looked up remotely.
- dede文章调用时过滤调 body里面的style属性和值
- java连接mysql :No Suitable Driver Found For Jdbc 解决方法
- mac安装nginx
- IOS webView快照
- Python核心编程读笔 1
- 鸟哥的LINUX私房菜基础篇第三版 阅读笔记 四 档案的文件系统的压缩和打包
- springmvc基础篇—掌握三种处理器
- bzoj 1098 poi2007 办公楼 bfs+链表
- RequestMethod.Post&;RequestMethod.GET
- scala中的isInstanceOf和asInstanceOf
- kubebapps 添加私有harbor 中的helm repo
- dubbo管控台安装
- bzoj1215
- Security Permissions Caching
- ORA-12505: TNS: 监听程序当前无法识别连接描述符中所给出的SID等错误解决方法
- POJ 2752 Seek the Name, Seek the Fame(KMP求公共前后缀)
- HDU - 4675 GCD of Sequence (莫比乌斯反演+组合数学)
热门文章
- RSA算法的基本原理
- HTML值改变事件
- webstorm中使用git管理服务器上的代码——入门级
- 服务器迁移部署OmsEdi
- 短URL系统、301/302重定向
- 6.Spring【AOP】XML方式
- React学习整理
- mysql5.7基于gtid进行搭建主从复制过程
- [编织消息框架][netty源码分析]3 EventLoop 实现类SingleThreadEventLoop职责与实现
- [转]iMPACT Spartan-6 FPGA - ";WARNING:iMPACT:2217-Error shows in the status register, CRC Error bit is Not 0";