我有个程序是用来复制程序的,却总是有问题,谁帮我看一下到底哪错了.import java.io.*;public class FileCopy
{
FileInputStream FIS;
FileOutputStream FOS; public boolean copyFile(String src, String des)
{
try
{
FIS = new FileInputStream(src);
FOS = new FileOutputStream(des);
byte[] bt = new byte[1024];
int readNum = 0;
while ((readNum = FIS.read(bt)) != -1)
{
FOS.write(bt, 0, bt.length);
}
FIS.close();
FOS.close();
return true;
}
catch (Exception e)
{
try
{
FIS.close();
FOS.close();
}
catch (IOException f)
{
// TODO
}
return false;
}
finally
{
}
}
}
{
FileInputStream FIS;
FileOutputStream FOS; public boolean copyFile(String src, String des)
{
try
{
FIS = new FileInputStream(src);
FOS = new FileOutputStream(des);
byte[] bt = new byte[1024];
int readNum = 0;
while ((readNum = FIS.read(bt)) != -1)
{
FOS.write(bt, 0, bt.length);
}
FIS.close();
FOS.close();
return true;
}
catch (Exception e)
{
try
{
FIS.close();
FOS.close();
}
catch (IOException f)
{
// TODO
}
return false;
}
finally
{
}
}
}
数组有可能没有充满数据。