首页 > 其他 > 详细

IO流

时间:2019-07-05 21:42:28      阅读:81      评论:0      收藏:0      [点我收藏+]
 

import java.io.FileInputStream;
import java.io.FileOutputStream;
public class File {
public static void main(String[] args) {
String file = new String ("data.txt");
try {


FileOutputStream out = new FileOutputStream(file);
byte str[] = "12345abcdef@#%&*软件工程".getBytes();
out.write(str);
out.close();
}catch(Exception e) {
e.printStackTrace();
}
try {
FileInputStream in = new FileInputStream(file);
byte yhl[] = new byte[1024];
int mr = in.read(yhl);


System.out.println("文件是: "+new String(yhl,0,mr));
in.close();

}

catch (Exception e) {
e.printStackTrace();
}
}
}

IO流

原文:https://www.cnblogs.com/pandashuai1/p/11140896.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!