• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why is BufferedReader not reading, but clearing my text file?  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Followed this: http://www.mkyong.com/java/how-to-read-file-from-java-bufferedreader-example/



In the constructor I create the BufferedReader using the FileReader and path to the input text file(in same dir as this project). When I am done reading I close it. In the debugger it is unable to read a single line, then goes to close the file.
 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's the BufferedWriter which is clearing your file, not the reader.
 
peter pham
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:It's the BufferedWriter which is clearing your file, not the reader.


Thanks that was it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!