IOE数据流读写

package File;

import java.io.*;

public class FileOutDemo {
    public static void main(String[] args) throws IOException {
       /* FileOutputStream fo=null;
        try {
         fo = new FileOutputStream("guoqing0308.txt");
        fo.write("abcdef".getBytes());
        fo.write("\n".getBytes());
            fo.write("abcde".getBytes());

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

    }
    finally {
        fo.close();
    }*/
      /*  FileInputStream fi = new FileInputStream("guoqing0308.txt");
        int  by;
        while((by=fi.read())!=-1){
            System.out.print((char)(by));

        }*/
       /* System.out.println((char)(by));
        by =fi.read();
        System.out.println((char)(by));
        by =fi.read();
        System.out.println((char)(by));
        by =fi.read();
        System.out.println((char)(by));
        by =fi.read();
        System.out.println((char)(by));
        by =fi.read();
        System.out.println((char)(by));
        by =fi.read();
        System.out.println((char)(by));
        by =fi.read();
        System.out.println((by));*/
        /*fi.close();*/
        //FileInputStream fi =new FileInputStream("guoqing0308.txt");
       /* FileOutputStream fo =new FileOutputStream( "boss.txt");

        BufferedOutputStream bu =new BufferedOutputStream(fo);
        bu.write("hello".getBytes());
        bu.write("java".getBytes());
        bu.close();*/
      /*  int by ;
        while((by = fi.read()) !=-1){
            fo.write(by);
        }
        fi.close();
        fo.close();*/
      /* byte [] bys =new byte[1024];
        int len = 0;

       while((len = fi.read(bys))!=-1 ){


           System.out.println(len);
           System.out.println( new String(bys,0,len));*/
      FileInputStream fo =new FileInputStream("guoqing0308.txt");
        BufferedInputStream buff =new BufferedInputStream(fo);
       /* int by ;
        while(( by=buff.read()) !=-1){
            System.out.print((char)(by));
        };*/
       byte [] bys=new byte[1024];
       int len;
       while((len=buff.read(bys))!=-1){
           System.out.println( new String(bys,0,len));

       }

       }

    }



 

上一篇:【CF566E】Restoring Map(构造)


下一篇:基于Visual C++2010与windows SDK fo windows7开发windows7平台的tabletpc应用(1)-手写数学公式输入