读写txt的方式
来源:互联网 发布:formtalk 阿里云 编辑:程序博客网 时间:2024/05/02 06:12
//字符的方式读取txt
BufferedReader reader=new BufferedReader(new FileReader("d://t.txt"));
String line="";
while((line=reader.readLine())!=null){
System.out.println(str);
}
//字节的方式读取txt
BufferedInputStream in=new BufferedInputStream(new FileInputStream("d://t.txt"));
BufferedOutputStream out=new BufferedOutStream(new FileOutInputStream("d://tt.txt"));
byte[] buff=new byte[1024]; int hasRead=0;
while((hasRead=in.read(buff,0,1024))!=-1){
out.write(buff,0,hasRead);
out.flush();
}
//写txt
String str="welcome to china";
byte[] buff=new byte[255];
buff=str.getBytes();
OutputStream out=new OutputStream(new File("d://t3.txt"));
out.write(buff,0,buff.length);
out.flush();
0 0
- 读写txt的方式
- C++读写txt文件方式以及基于opencv的Mat数据类型读写txt文件类型
- C++读写txt文件方式以及基于opencv的Mat数据类型读写txt文件
- java读写txt文档的几种方式
- 【C#】txt的读写
- C#TXT文本的读写
- MFC --txt文本文件的读写
- MFC TXT 文本文件的读写
- 对txt读写改的java类
- C#与TXT文件的读写操作
- matlab 读写txt文本文件的方法
- matlab txt文件 矩阵的读写
- java 版 用来读写txt的玩具
- C#读写txt文件的方法
- 读写Unicode带中文的txt文件
- ini和txt文件的读写
- java读写TXT文件的方法
- 配置文件的读写.txt .dat .ini
- Linux Socket编程(不限Linux)
- HDU 1175 连连看 (DFS +剪枝)
- YUV格式详解
- JS图片垂直不间断滚动(从下到上)
- LWIP使用经验
- 读写txt的方式
- 好资源
- jQuery学习笔记之七-----表单选择器
- 中小企业,怎么接近MES
- 没人教的项目管理方法
- vim的使用教程
- golang json处理struct未导出成员
- 杨毅:不够优秀就不要腆着脸继续占便宜
- bbpress 搜索