Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

chapter05 : FileCopy 본문

JAVA/chapter24_io

chapter05 : FileCopy

GAWON 2023. 5. 31. 09:22
package org.joonzis.ex;

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

public class Ex05_FileCopy {
	public static void main(String[] args)throws IOException {

//		FileInputStream fis = new FileInputStream("alphabet.txt");
//		BufferedInputStream bis = new BufferedInputStream(fis);
		//위와 동일
		
		BufferedInputStream bis =
				new BufferedInputStream(new FileInputStream("alphabet.txt"));
		
		
//		FileOutputStream fos = new FileOutputStream("alphabet.txt");
//		
//		BufferedOutputStream bis = new BufferedOutputStream(fos);
//		
//		
		
		BufferedOutputStream bos = 
				new BufferedOutputStream(new FileOutputStream("alphabet2.txt"));
		
		int data;
		while((data = bis.read())!= -1){
			bos.write(data);
		}
		bis.close();
		bos.close();
	}
}

'JAVA > chapter24_io' 카테고리의 다른 글

Test . io  (0) 2023.05.31
chapter06 : FileCopy  (0) 2023.05.31
chapter04 : FileInput  (0) 2023.05.31
chapter03 : FileOutput  (0) 2023.05.31
chapter02 : FileInput  (0) 2023.05.31