转换流
@Test
public void test4() throws IOException {
InputStreamReader isr = null;
try {
FileInputStream fis = new FileInputStream("D:\\java.txt");
isr = new InputStreamReader(fis,"UTF-8");
char[] cbuf = new char[5];
int len = 0;
while ((len = isr.read(cbuf))!=-1){
System.out.print(new String(cbuf,0,len));
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if(isr!=null)
isr.close();
}
}

浙公网安备 33010602011771号