FileInputStream fis = new FileInputStream("filePath"); // filePath为文件路径
// 声明一个字节数组
byte[] b = new byte[1024];
StringBuffer str = new StringBuffer();
int len ;
// 循环读取
while ((len = fis.read(b)) != -1) {
str.append(new String(b, 0, len));
}
System.out.println(str.toString());
相关资源:JAVA解决URL路径中含有中文的问题