import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileOutputStreamEx {
public static void main(String[] args) {
File f = new File("C:/noirjo/work1/alter_jari/src/month7_day9/FileTest.java"); //복사할 내용이 있는 파일..
FileInputStream fis = null;
FileOutputStream fos = null;
byte[] bytes = new byte[256];
int _byte=-1;
try{
fis = new FileInputStream(f);
fos = new FileOutputStream("D:/test.txt"); //복사할 파일.....
while((_byte = fis.read()) != -1){
fos.write(_byte);
}
System.out.println("다 읽고 복사 완료!!");
} catch(Exception e){
e.printStackTrace();
} finally{
try{
if(fis!=null) fis.close();
if(fos!=null) fos.close();
} catch (IOException e){
}
}
}
}
'2020년도 이전 > 입출력' 카테고리의 다른 글
파일 읽기.... (0) | 2013.07.09 |
---|---|
경로에 있는 Directory와 파일의 바이트 크기 출력 (0) | 2013.07.09 |
알파벳 입력하면 아스키코드 출력 (0) | 2013.07.09 |