Mick.987

相信开源,才是未来的春天!

 

得到汉字字库的集合

/**
     * 得到汉字字库的集合
     * @return
     */
    public static Map getChinaWordStorage()
    {
        BufferedReader bu=null;
        try {
            Map map=new TreeMap();
            bu=new BufferedReader(new InputStreamReader(new FileInputStream(getPropertiesByKey("chinaWord")),"UTF-8"));//文件放在tomcat/bin下
            
            String line= bu.readLine();
                // System.out.println(line);
                 while(line!=null&&!line.equals(""))
                 {
                      map.put(line.trim(), line.trim().substring(0,1)); 
                     line= bu.readLine();
                 }
            //bu.close();
            return map;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally{
            if(bu!=null){
                try {
                    bu.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        
    }

 

宝贝网址:

posted on 2014-06-06 15:29  张朋飞  阅读(240)  评论(0编辑  收藏  举报

导航