This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes First line of file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "First line of file" Watch "First line of file" New topic

First line of file

Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 331

I am reading form a .data file but it only seems to be reading the first line of the code when I in more than the next code in the loop

It works well in the example but if I in in the loop something like

it only reads the first line
Any idea?


Tony Docherty

Joined: Aug 07, 2007
Posts: 2175
I suggest you read the AvailableDoesntDoWhatYouThinkItDoes FAQ
Rob Spoor

Joined: Oct 27, 2005
Posts: 19655

Also, you can't call dis.readLine() twice while still expecting the same line to be returned. Any method that reads part of a file (or InputStream or Reader) moves forward in the file (or InputStream or Reader). Anything that was just read won't be re-read again unless you use the mark / reset method pair.

How To Ask Questions How To Answer Questions
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: First line of file
Similar Threads
how exactly can i make out if a file in linux has just been updated or has been replaced.
java uses or overrides a deprecated API.
how to read line by line and pass each line value to a method
How can I use StringBuffer in this case...
writing data to CSV file