http://www.verejava.com/?id=16994667084611
package com.io;
import java.io.*;
public class TestInputStreamReader
{
public static void main(String[] args)
{
InputStream is=null;
try
{
is=new FileInputStream("res/chinese.txt");
//将inputStream 转换成 Reader
Reader reader=new InputStreamReader(is);
int l;
while((l=reader.read())!=-1)
{
System.out.println((char)l);
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
try
{
is.close();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
http://www.verejava.com/?id=16994667084611
原文地址:https://www.cnblogs.com/verejava/p/9227207.html
时间: 2024-11-05 17:19:00