글쓴이 :박찬우 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();
}
}