码迷,mamicode.com
首页 > 其他好文 > 详细

I/O

时间:2019-06-20 12:34:04      阅读:71      评论:0      收藏:0      [点我收藏+]

标签:string   cat   工程   bytes   str   catch   pac   puts   文件   

package qwe;
import java.io.;
public class Qwe {
public static void main(String[] args) throws IOException {
File f=new File("C:\data.txt");
try {
FileOutputStream out=new FileOutputStream(f);
byte str[]="12345abcdef@#%&
软件工程".getBytes();
out.write(str);
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try{
FileInputStream in=new FileInputStream(f);
byte byt[]=new byte[1024];
int len=in.read(byt);
String ss = null;
System.out.println("文件中的信息是:"+ ss);
in.close();
}catch(Exception e){
e.printStackTrace();
}
}

}

I/O

标签:string   cat   工程   bytes   str   catch   pac   puts   文件   

原文地址:https://www.cnblogs.com/6825186a/p/11057873.html

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