错误出在哪里了?
public class CopyFilesUnit {
public static void main(String[] args){
String scrFile=args[0];
String destFile=args[1];
//fileCopy(scrFile,destFile);
if(fileCopy(scrFile,destFile)){
System.out.println("文件自制成功");
}else{
System.out.println("文件自制不成功");
}
}
public static boolean fileCopy(String scrScr,String destScr){
File scrFile,destFile;
FileInputStream in=null;
FileOutputStream out=null;
boolean flag=false;
try{
scrFile=new File(scrScr);
destFile=new File(destScr);
if(!destFile.exists()){
destFile.createNewFile();
}
in=new FileInputStream(scrFile);
out=new FileOutputStream(destFile);
byte[] butf=new byte[1024];
int len;
String str=null;
//StringBuffer str=new StringBuffer();
while((len=in.read(butf))!=1){
str=new String(butf,0,len);
}
//String st=str.toString();
byte[] buff=str.getBytes();
out.write(buff);
in.close();
out.close();
flag= true;
}catch(IOException e){
}
return flag;
}
}