读取含有中文的文件
程序员文章站
2024-02-04 08:13:16
...
InputStream inputStream = new FileInputStream("1.txt");
int c=-1;
byte[] buffer = new byte[inputStream.available()];
while((c=inputStream.read(buffer))!=-1)
{
String s = new String(buffer, "gbk");
System.out.print(s);
}
inputStream.close();
上一篇: 一篇文章搞懂Promise
下一篇: InputStream流读取外部链接数据