代码附上:
public class BufferedTest {
public static void main(String[] args) throws IOException
{
BufferedReader bReader = new BufferedReader(
new InputStreamReader(new FileInputStream("countBrowser/part-r-00000")));
- String msg = null;
- while((msg = bReader.readLine()) != null)
- {
- System.out.println(msg);
- }
-
-
- while((msg = bReader.readLine()) != null)
- {
- System.out.println(msg);
- }
- }
}
文件的内容只是显示了一次,应该是使用bReader读完以后,文件指针移到了文件的末尾,再读取就读取不出来了,但是怎么移到文件的开头呢?求教大家了