JAVA- IO-Copy(InputStream - OutputStream)

863 단어 OutputStream
package test;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Copy {

	/**
	 * copy:
	 * 1.         
	 * 2.         
	 * 3.          ,       
	 */
	public static void main(String[] args) throws IOException {
		//               
		FileInputStream fis = new FileInputStream("D:/qq/aa.txt");
		FileOutputStream fos = new FileOutputStream("D:/qq/bb.txt");//        
		byte[] b = new byte[1024];
		int len = 0;
		//                
		if((len = fis.read(b))!= -1){	
			fos.write(b, 0, len);
		}
		System.out.println("copy success~");
		//      ,      
		fos.close();
		fis.close();

	}

}

좋은 웹페이지 즐겨찾기