I/O

Posted 6825186a

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了I/O相关的知识,希望对你有一定的参考价值。

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[]="[email protected]#%&
软件工程".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的主要内容,如果未能解决你的问题,请参考以下文章