1public static String getSource(String fileName) {
 2        
 3        String s="";
 4        File file = new File(fileName);
 5        Reader reader = null;
 6        try {
 7            RandomAccessFile rf=new RandomAccessFile(fileName,"r");
 8            byte  contents[]=new byte[(int)rf.length()];
 9            rf.read(contents, 0, (int)rf.length());
10            s=new String(contents);
11            //s=new String((char[])contents);
12        }
 catch (Exception e) {
13            e.printStackTrace();
14        }

15        return s;
16    }
Homepage: http://www.zoumin.org/
Posted on 2010-05-29 21:38 邹敏 阅读(483) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理