public void dealFile(String fileName, byte[] bs) { try { bs = convertCharset(bs); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } fileName = fileName.substring("File:".length()); this.task.setCurrentInfo("正在导入站点文件:" + fileName); String root = Config.getContextRealPath() + Config.getValue("Statical.TargetDir") + "/" + this.map.getString("Alias"); root = root + "/"; fileName = root + fileName; fileName = fileName.replaceAll("[\\\\/]+", "/"); String dirName = fileName.substring(0, fileName.lastIndexOf('/')); File dir = new File(dirName); if (!dir.exists()) { dir.mkdirs(); } FileUtil.writeByte(fileName, bs); }