(죄송~) 보기 좋게...


[ 다음 글들 ] [ 이어서 글올리기(답하기) ] [ 자바 묻고 답하기 ]

글쓴이 :박찬우 2000년 5월 23일 13:21:09

In Reply to: Object(Input/Output)Stream은... posted by 박찬우 on 2000년 5월 23일 13:19:29:



import java.io.*;


public class CopyBytes {
public static void main(String [] args) throws IOException {
File inputFile = new File("sample.txt");
File outputFile = new File("temp.txt");



FileInputStream fin = new FileInputStream(inputFile);
FileOutputStream fout = new FileOutputStream(outputFile);


BufferedReader in = new BufferedReader(new InputStreamReader(fin));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fout));



String str;



while ((str = in.readLine()) != null) {
out.write(str); //Writer 클래스에서 상속받은 메서드
out.newLine();
out.flush();
}


fin.close();
fout.close();


in.close();
out.close();
}
}





다음 글들:



이어서 글올리기(답하기)

이름:
E-Mail:
제목:
내용:
HTML 태그 포함 여부: HTML 문서일 경우 체크
관련 URL(선택):
URL 제목(선택):
관련 이미지 URL:


[ 다음 글들 ] [ 이어서 글올리기(답하기) ] [ 자바 묻고 답하기 ]