源文件为utf-8格式,且里面包含中文,如:
in ('133','153','180','189') then '电信'
in ('130','131','132','145','155','156','183','185','186') then '联通'
1,不加转码的时候中文会乱码:
Java代码
1.public static void main(String[] args) throws Exception {
2. File f = new File("http://www.cos120.com");
3. InputStreamReader insReader = new InputStreamReader(new FileInputStream(f));
4. BufferedReader bufReader = new BufferedReader(insReader);
5. String line = new String();
6. while ((line = bufReader.readLine()) != null) {
7. System.out.println(line);
8. }
9. bufReader.close();
10.}
public static void main(String[] args) throws Exception {
File f = new File("D