Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to read .DAT file in java

807589Aug 26 2008 — edited Aug 26 2008
Hello,
My code to read .DAT file gave me incorrect result. My .DAT file is having record with three columns (zip, latitude, longitude). When I read this .DAT file in DELPHI, giving correct result but not in java.

I have given my java code below,

File f = new File("c:/ZipTile.dat");
FileInputStream file_input = new FileInputStream (f);
DataInputStream data_in = new DataInputStream (file_input );
while (true) {
try {
System.out.println" Zip5 " + data_in.readInt() + " lat " + data_in.readInt() + " lon " + data_in.readInt());
} catch (EOFException eof) {
System.out.println ("End of File");
break;
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 23 2008
Added on Aug 26 2008
18 comments
14,531 views