`

readme

 
阅读更多

2011-3-1

/**
  * 循环创建父目录
  * @param outFileName
  */
  private void makeSupDir(String outFileName) {
  //匹配分隔符
  Pattern p = Pattern.compile("[/\\" + File.separator + "]");
  Matcher m = p.matcher(outFileName);
  //每找到一个匹配的分隔符,则创建一个该分隔符以前的目录
  while (m.find()) {
  int index = m.start();
  String subDir = outFileName.substring(0, index);
  File subDirFile = new File(subDir);
  if (!subDirFile.exists())
  subDirFile.mkdir();
  }
  }

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics