要自行指定字符编码值,请使用 CharsetDecoder 在 FileInputStream 上构造一个 InputStreamReader。
public static void main( String[] args ) {
InputStreamReader reader = null;
try {
reader = new InputStreamReader( new FileInputStream("file1"), "UTF-16BE");
System.out.println( reader.read() );
} catch ( IOException e ) {
e.printStackTrace();
}
}
|
|