posts - 66, comments - 12, trackbacks - 0, articles - 0

java 读取文件

Posted on 2012-02-09 12:54 cyantide 阅读(191) 评论(0)  编辑  收藏
// String openWinAdvleftJS=Util.getPropertiesVal("picInfoPath");
        String openWinAdvleftJS = "E:\\\u9996\u4FE1\\\u8D22\u653F\u5C40\\other\\\u5F39\u51FA\u6846\\\u7EFC\u5408\u529E\u516C\u5E73\u53F0\\advleft.js";
        System.out.println(openWinAdvleftJS);

        StringBuffer sb = new StringBuffer();

        InputStreamReader fr = null;
        try {
            fr = new InputStreamReader(new FileInputStream(openWinAdvleftJS),"gb2312");
            int ch = 0;
            while ((ch = fr.read()) != -1) {
                sb.append((char)ch);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fr != null) {
                try {
                    fr.close();
                } catch (IOException e1) {
                }
            }
        }

        System.out.println(sb.toString());
        
        System.out.println("////");

只有注册用户登录后才能发表评论。


网站导航: