2014-04-07 61 views

回答

0

試試這個:

  // create new buffered reader 
     BufferedReader br = new BufferedReader(new FileReader("file.txt")); 

     // reads and prints BufferedReader 
     System.out.println((char)br.read()); 
     System.out.println((char)br.read()); 

     // mark invoked at this position 
     br.mark(26); 
     System.out.println("mark() invoked"); 
     System.out.println((char)br.read()); 
     System.out.println((char)br.read()); 

     // reset() repositioned the stream to the mark 
     br.reset(); 
     System.out.println("reset() invoked"); 
     System.out.println((char)br.read()); 
     System.out.println((char)br.read()); 
0

將它包裝在BufferedReader中,並有足夠的緩衝區大小滿足您的需求。