如果你是读取文本类数据,建议采用reader类,如InputStreamReader或BufferedReader之类的,可以省去这个疑虑。 如果非要用stream流,读取byte数组,建议将数据全部读上来再转换为String,不然你必须要知道该文件的编码格式。 FileInputStream 适用于字节流 java 读取文件流乱码输出乱码 File f1 = new File ("a.txt"); FileInputStream is=new FileInputStream(f1); int i; while((i=is.read())!=-1){ System.out.print((char)(i)); } 如果你全是中文的话,中文是两个字节,那么可以采用两个字节一起读,如果你中英文交叉的文本,那就不好办了,只能把文本一次性全都读进来再输出。 纯中文读取: File f1 = new File ("a.txt"); FileInputStream is=new FileInputStream(f1); int i; byte[] b =new byte[2]; while((i=is.read(b))!=-1){ System.out.print(new String(b)); } 中英文混合的文本读取 byte[] b =new byte[yourtxtlength]; yourtxtlength就是你文本字节的长度