求姐!小弟,新手自学java基础,帮能我看看为什么拷贝完大小不一样?
import *;class CopyDemo
{
public static void main(String[] args)
{
System.out.println("Hello World!");
method_2();
}
//拷贝一个mp3文件
public static void method_2()
{
FileInputStream fi= null;
FileOutputStream fo= null;
try
{
fi = new FileInputStream("积木.mp3");
fo = new FileOutputStream("积木_copy.mp3");
BufferedReader br = new BufferedReader(new InputStreamReader(fi));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fo));
String len = null;
while((len = br.readLine())!=null)
{
bw.write(len);
bw.newLine();
bw.flush();
}
}
catch (IOException e)
{
throw new RuntimeException("读写失败");
}
finally
{
try
{
if(fi!=null);
fi.close();
}
catch (IOException e)
{
throw new RuntimeException("读入失败");
}
try
{
if(fo!=null);
fo.close();
}
catch (IOException e)
{
throw new RuntimeException("写入失败");
}
}
}
}