FileInputStream读取文件内容

来源:互联网 发布:c语言入门后学什么 编辑:程序博客网 时间:2024/05/13 08:33
               File f=new File("e:/abc.txt");FileInputStream fis;try {fis=new FileInputStream(f);byte b[]=new byte[1024];int n=0;while((n=fis.read(b))!=-1){String s=new String(b, 0, n);System.out.println("文件内容:"+s);}} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}

0 0
原创粉丝点击