public static void readFile(){ BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader(new FileInputStream("D://TZ_0104_171115202150.QS"), "UTF-16")); String line = null; while((line = in.readLine()) != null) { System.out.println(line); } }catch (Exception e) { e.printStackTrace(); }finally { if(in != null) { try { in.close(); }catch (Exception e) { e.printStackTrace(); } } } }
D://TZ_0104_171115202150.QS是UCS2-little endian编码的文件,用utf-8字符流接收会出现全文本乱码,用上述utf-16接收可以解决问题。