What is the ".dat" file? That extension doesn't really mean anything and many programs store many different types of things using that extension in many different formats. If know what is saved, and, more importantly, how it is saved, we could give you a better answer. P.S. A BufferedReader will only work "properly" for text files.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
Okay? So how are you saving that? With a RandomAccessFile? A DataOutputStream? An ObjectOutputStream? A FileWriter?
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
A .dat file is perfectly fine. .dat files can take the same things as .txt files, therefore it can take strings, ints, etc.
Yes it can, but that's not quite the point. The point is thathow it is written will greatly affect, of course, how it is to be read.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
But the book I'm reading from uses Scanner, is it still basically the same thing though?
Dannyo329
Junior Poster in Training
79 posts since Apr 2008
Reputation Points: 20
Solved Threads: 8
That also does nothing other than read bytes and interpret them as characters (i.e. text files and text files only). If the data is not being saved as simple text written using a filewriter (or fileoutputstream), but rather as a data or object outputstream you won't be able to use that.
Since the OP doesn't feel the need to tell us exactly what the .dat file consists of (he has told us the "data" that may be in it, but not how that is represented in the file) I no longer fell the need to help.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494