zoukankan      html  css  js  c++  java
  • iostream

    package com.cust.wu;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.FileWriter;




    public class zifu {
    public static void main(String[] args){
        int n;
        try{
            FileReader fr=new FileReader("d:/test.txt");
            FileWriter fw=new FileWriter("e:/test.txt");
            char[] buffer=new char[10];
            while(( n =fr.read(buffer,0,10))!=-1){
                System.out.println(buffer);
                fw.write(buffer,0,n);
            }
            
        }
        catch(FileNotFoundException t){
            System.out.println("not found");
        }
        catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }
    }

        

    }











    package com.cust.wu;

    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;

    public class iostream {
        public static void main(String[] args){
            int n;
            try{
                File f = new File("D:/test.jpg");
                FileInputStream fis =new FileInputStream(f);
                FileOutputStream fos= new FileOutputStream("e:/test.jpg");
                byte[] buffer=new byte[10];
                while((n=fis.read(buffer,0,10))!=-1){
                    fos.write(buffer,0,n);
                    
                }
            }
            catch (FileNotFoundException t) {
                System.out.println("not found");
                // TODO: handle exception
            }
             catch (Exception e) {
                // TODO: handle exception
                 e.printStackTrace();
            }
            
        }


    }


  • 相关阅读:
    UICollectionViewController用法
    UISegmentedControl的详细使用
    &#x开头的是什么编码呢。浏览器可以解释它。如中国等同与中文"中国"?
    Random.nextint() 和Math.random()的区别
    UIGestureRecognizer ios手势识别温习
    [工具]Mac平台开发几个网络抓包工具(sniffer)
    IOS中Json解析的四种方法
    iOS官方Sample大全
    Ubuntu 16.04安装cuda7.5 GCC
    Ubuntu中升极下载4.2内核
  • 原文地址:https://www.cnblogs.com/helloaworld/p/6048176.html
Copyright © 2011-2022 走看看