讀取的檔案為UTF-8編碼
BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream(outputPath),"UTF-8"));
StringBuffer sb = new StringBuffer();
String tmp = "";
while ((tmp= br.readLine())!=null){
sb.append(tmp);
}
for (int i = 0; i < sb.length(); ++i){
System.out.println("第"+i+"個字:"+sb.charAt(i));
System.out.println("十六進位 >>> " + Integer.toHexString(sb.charAt(i)));
System.out.println("八進位 >>> " + Integer.toOctalString(sb.charAt(i)));
System.out.println("二進位 >>> " + Integer.toBinaryString(sb.charAt(i)));
}
留言列表