| | |
| | | fileName = ActionUtil.filterFileName(fileName); |
| | | ClassPathResource classPathResource = new ClassPathResource("/config/"+fileName); |
| | | InputStream inputStream_pub = null; |
| | | FileOutputStream fos=null; |
| | | ApplicationHome applicationHome = new ApplicationHome(LicenseController.class); |
| | | File jarFile = applicationHome.getDir(); |
| | | String fileDirName = jarFile.getParentFile().toString()+ File.separator+"ksm"; |
| | |
| | | createFile(fileDirName);//创建文件夹ksm |
| | | try { |
| | | inputStream_pub = classPathResource.getInputStream(); |
| | | FileOutputStream fos = new FileOutputStream(fileDirName+"/"+fileName); |
| | | fos = new FileOutputStream(fileDirName+"/"+fileName); |
| | | byte[] b = new byte[1024]; |
| | | int length; |
| | | while((length = inputStream_pub.read(b))>0){ |
| | | fos.write(b,0,length); |
| | | } |
| | | inputStream_pub.close(); |
| | | |
| | | fos.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | if(inputStream_pub!=null){ |
| | | try { |
| | | inputStream_pub.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if(fos!=null){ |
| | | try { |
| | | fos.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return fileDirName; |
| | | } |