使用java 程序创建格式为utf-8文件的方法:
  
try{
            File file=new   File("C:/11.jsp");  
            OutputStream out=new FileOutputStream(file);
            BufferedWriter   rd   =   new BufferedWriter(new OutputStreamWriter(out,"utf-8"));
            rd.write("333333333333中国");
            rd.close();
            out.close();
        }catch(IOException e){
            e.printStackTrace();
        }

//判断文件是否存在

//(获取服务器的config下的路径)
File fileExit = new File(this.getClass().getClassLoader().getResource(path).toURI().getPath());
if(!fileExit.exists()){
return fileContent;
}

//(获取webroot下文件路径)

ServletContext sctx = ServletActionContext.getServletContext();
String path = sctx.getRealPath("/");// 服务器文件路径
File filePath=new File("uploadfiles/temp/"+"2016-11-09");//拼接文件路径

String fileContent = "";
InputStreamReader file = new InputStreamReader(
IGetEshopid.class.getClassLoader()
.getResourceAsStream(path), "UTF-8");
BufferedReader reader = new BufferedReader(file);

String tempString = null;
while ((tempString = reader.readLine()) != null) {
fileContent += tempString;
}
reader.close();
return fileContent;

最新文章

  1. 如何设置ASP.NET页面的运行超时时间 (转载)
  2. 提高sevenzipsharp 检查密码的速度(1)
  3. 读Lua游戏开发实践指南
  4. 【VLC-Android】vlc-android简例
  5. 《浅谈磁盘控制器驱动》,磁盘控制器驱动答疑解惑![2012.1.29完结]by skyfree
  6. UVa 二叉树重建(先序+中序求后序)
  7. java攻城狮之路(Android篇)--ListView与ContentProvider
  8. Altium Designer哪里下载和导入元件库_图文教程
  9. Codeforces Round #260 (Div. 1) A. Boredom (简单dp)
  10. IEEE二进制浮点数算术标准(IEEE 754)
  11. [转] 考验你的JavaScript底细
  12. Hibernate二 映射 注解 一级缓存
  13. html5 手机APP计算高度问题
  14. [Cycle.js] Generalizing run() function for more types of sources
  15. java系列--集合
  16. linux下启动tomcat----Cannot find ./catalina.sh
  17. 在CMainFrame里使用定时器是有讲究的
  18. 21_Android中常见对话框,光传感器,通过重力感应器编写出指南针应用,帧动画,通过Jav代码的方式编写补间动画,通过XML的方式编写补间动画
  19. 通过反射实现get和set方法
  20. Pandas系列(三)-缺失值处理

热门文章

  1. zedboard如何从PL端控制DDR读写(四)
  2. Image zImage uImage
  3. 在一般处理文件中访问Session需要添加IRequiresSessionState(转载)
  4. 解决多网卡SNMP获取不到数据的问题
  5. Oracle Database 11G R2 标准版 企业版 下载地址(转)
  6. 循序渐进之Spring AOP(6) - 使用@Aspect注解
  7. JSF2 下 taglib 的问题
  8. Groovy basic
  9. Eclipse中Maven项目添加jar包
  10. iOS 地图