public class StreamDemo{
public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
FileInputStream file=new FileInputStream("E://iotest//iotest.txt");
InputStreamReader reader=new InputStreamReader(file, "utf8");
BufferedReader buffer=new BufferedReader(reader);
String readLine;
try {
while((readLine=buffer.readLine())!= null) {
System.out.println(readLine);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Java利用io流,读取文档并输出到控制台
猜你喜欢
转载自blog.csdn.net/xiaoxiamiqianqian/article/details/81107184
今日推荐
周排行