- package d19;
- import java.io.BufferedReader;
- import java.io.BufferedWriter;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.io.OutputStreamWriter;
- public abstract class Test {
- public static void main(String[] args) throws IOException {
- // TODO 自动生成的方法存根
- BufferedReader bufr =
- new BufferedReader(new InputStreamReader(new FileInputStream("1.txt")));
- BufferedWriter bufw=
- new BufferedWriter(new OutputStreamWriter(new FileOutputStream("2.txt")));
-
- String s=null;
- while((s=bufr.readLine())!=null)
- {
- bufw.write(s);
- bufw.newLine();
- bufw.flush();
- }
-
- bufr.close();
- bufw.close();
- }
- }
复制代码 用转换流复制mp3和jpg为什么会发生数据丢失,而复制txt则不会丢失呢?是我代码的问题吗?
|
|