import java.io.*;
class CopyPic
{
public static void main(String[] args)
{
FileOutputStream fos=null;
FileInputStream fis=null;
try
{
fos=new FileOutputStream("d:\\copy_1.jpg");
fis=new FileInputStream("d:\\1.jpg");
byte[] buf=new byte[1024];
int len=0;
while((len=fis.read(buf))!=-1)
{
fos.write(buf,0,len);
}
}
catch (Exception e)
{
throw new RuntimeException("fuzhi shibai ");
}
finally
{
try
{
if(fis!=null)
fis.close();
}
catch (Exception e)
{
throw new RuntimeException("duqu shibai ");
}
try
{
if(fos!=null)
fos.close();
}
catch (Exception e)
{
throw new RuntimeException("xieru shibai ");
}
}
}
}
请问我这个程序为什么编译正常 运行抛 fuzhishibai,查看d盘有个copy_1.jpg 但是0字节;我找了两遍没有找到问题的根源,大家帮下....谢谢
|
|