流的readLine方法

流的readLine方法用于读取一行数据,但不包括换行符。
因此,读文件的时候要自己加上。如:

InputStreamReader isr = new InputStreamReader(new FileInputStream(fileName,"utf-8");
brin = new BufferedReader(isr);
while((s = brin.readLine())!=null){
but+=s.toString()+[u]System.getProperty("line.separator")[/u];//当前系统的换行符windows是\r\n,unix是\n
}

猜你喜欢

转载自blog.csdn.net/sxbcsdn/article/details/83259524