- public static void main(String[] args) {
- try {
- InputStream in =MainClass.class.getResourceAsStream("a.properties");
- InputStreamReader input = new InputStreamReader(in
- , "8859_1");
- BufferedReader reader = new BufferedReader(input);
- while(true) {
- String line = reader.readLine();
- if(line == null) {
- break;
- }
- line = line.trim();
- System.out.println("line:"+line);
- line= new String(line.getBytes("UTF-8"),"GB2312");
- System.out.println("line2:"+line);
- }
- }
- catch(Exception e) {
- System.out.println(e);
- }
- }
java文件读取
最新推荐文章于 2024-11-11 21:19:25 发布