复制a.jpg到b.jpg

package io.day5;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class TestCopy {
  public static void main(String[] arys) throws Exception{
  DataInputStream dis = new DataInputStream(new FileInputStream("Test/xy.jpg"));
  DataOutputStream dos = new DataOutputStream(new FileOutputStream("Test/wd.jpg"));
  int wd;
  while((wd=dis.read())!=-1){
    dos.write(wd);
  }
   dos.close();
  dis.close();
  }
}

posted @ 2017-05-31 15:40  孤独患者xy  阅读(269)  评论(0编辑  收藏  举报