zoukankan      html  css  js  c++  java
  • 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;
    }

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

  • 相关阅读:
    《Android 4游戏高级编程(第2版)》书评
    push研究——Apache Mina探索初步
    Android UI开发第二十三篇——分享书架UI实现
    cookie学习总结
    Web.xml配置详解
    Java序列化的机制和原理
    Java高级技术(汇总中...)
    [Java]HashMap的两种排序方式
    jdk与jre的区别
    DM,NLP常用算法汇总
  • 原文地址:https://www.cnblogs.com/ytsbk/p/10550595.html
Copyright © 2011-2022 走看看