copyfile.java

来自「此为图书管理系统」· Java 代码 · 共 29 行

JAVA
29
字号
package   com.bean;
import java.io.* ;
public class copyFile
{
    public copyFile(){}
    public String copyFl(String oldFile,String newFile) { 
        int b = 0 ;
        String str="";
        FileInputStream fin = null ;
        FileOutputStream fout = null ;
        try{
            fin = new FileInputStream(oldFile) ;
            fout = new FileOutputStream(newFile) ;
            while((b = fin.read()) != -1) {
                fout.write(b) ;
            } 
            fin.close() ;
            fout.close() ;
        }
        catch(FileNotFoundException ef) {
            str= "找不到数据库!";
        }
        catch(IOException eio) {
            str= "数据库备份错误!";
        }
        str= "数据库备份完成!";
        return str;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?