使用BufferedReader一行一行读取一边文章中所有的字符?
------解决方案--------------------
一行一行读 就用readLine方法
------解决方案--------------------
String str=null;
while((str=br.readLine())!=null){
sb.append(str);
}
------解决方案--------------------
如1、2楼所说。
------解决方案--------------------
执行这个方法就行了:
[code=Java][/code]public class ReadLineTest {
public static void main(String[] args) throws Exception {
BufferedReader buffer = new BufferedReader(new InputStreamReader(new FileInputStream(new File("E:\\myself\\oracle导数据.txt"))));
String tempStr = "";
while((tempStr=buffer.readLine())!=null) {
System.out.println(tempStr);
}
}
}
------解决方案--------------------
- Java code
public class ReadLineTest { public static void main(String[] args) throws Exception { BufferedReader buffer = new BufferedReader(new InputStreamReader(new FileInputStream(new File("E:\\myself\\oracle导数据.txt")))); String tempStr = ""; while((tempStr=buffer.readLine())!=null) { System.out.println(tempStr); } }}