• java服务器备份(复制)


    public ResponseResult serverBackup (String[] datypeid)throws IOException{
    ResponseResult rr = new ResponseResult();
    Properties props = new Properties();
    InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("jdbc.properties");
    props.load(inputStream);
    String oldrootPath = props.getProperty("material");
    String rootPath = props.getProperty("backupAddress");
    List<String> affixIdList = affixService.getAffixId(datypeid);
    List<String> affixPathList = new ArrayList<>();
    for(int i = 0;i< affixIdList.size();i++){
    String path = affixService.getAffixPath(affixIdList.get(i));
    if(path != null){
    affixPathList.add(path);
    }
    }
    for(int j = 0 ; j < affixPathList.size();j++){
    FileInputStream fis
    = new FileInputStream(new java.io.File(affixPathList.get(j)));
    BufferedInputStream bis
    = new BufferedInputStream(fis);
    String newPath = affixPathList.get(j).replace(oldrootPath,rootPath);
    java.io.File newFile = new java.io.File(newPath);
    if( !newFile.getParentFile().exists()) {
    newFile.getParentFile().mkdirs();
    }
    FileOutputStream fos
    = new FileOutputStream(newFile);
    BufferedOutputStream bos
    = new BufferedOutputStream(fos);
    int d = -1;
    while((d = bis.read())!=-1){
    bos.write(d);
    }
    bis.close();
    bos.close();
    }
    rr.setMessage("success");
    rr.setState(1);
    return rr;
    }

    ---恢复内容结束---

  • 相关阅读:
    JDBC-HikariCP
    11、JDBC-Druid
    JDBC-DBCP
    JDBC-C3P0
    第十七篇-使用RadioGroup实现单项选择
    第十六篇-使用CheckBox实现多项选择
    第一篇-ubuntu18.04访问共享文件夹
    第十五篇-EditText做简单的登录框
    第十四篇-ImageButton控制聚焦,单击,常态三种状态的显示背景
    第十三篇-通过Button设置文本背景颜色
  • 原文地址:https://www.cnblogs.com/ytsbk/p/10550595.html
Copyright © 2020-2023  润新知