• Post Reply Bookmark Topic Watch Topic
  • New Topic

Read file until EOF from offset each time  RSS feed

Hall Nation
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aight. This is my question :

Now, I need to read a file (whose contents may keep changing over the course of the 100 seconds). Everytime I read the contents of the file, I need to get the new data (that's been added).
PS : No data will be deleted from the file. Data would only be added.

So, I assume I require to mark an offset and read from that offset until I encounter EOF. Every single time. How do I do this?

I'm using BufferedReader and there's this method :

But, I do not know the len (length of characters) to be read each time. Remember, I need to read till EOF everytime. Someone suggested me to use the ready() method of BufferedReader, but I'm lost and do not know how to use it. Can someone put up a prototype example depicting this situation?

One other suggestion was not to use ready() but read until I encounter an Exception.. How do I use it if I want to go this way?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!