Article View: borland.public.jbuilder.java.language
Article #17037Newbie having trouble reading random access binary data file
From: Gary Irwin
Date: Tue, 15 Dec 1998 00:00
Date: Tue, 15 Dec 1998 00:00
20 lines
1527 bytes
1527 bytes
Hi: I am new to Java but having a great time learning it - its a super language! I have a binary database file consisting of a mixture of strings, long ints and doubles. The database was originally created using Microsofts 16 bit 'C' 6.0 compiler (not VC6.0) running in DOS, therefore the strings are simple byte arrays, long ints are 4 byte and doubles 8 byte. I have successfully written read/write routines to the database using VB 6 and C++Builder 3, and am now moving to the Java platform with JBuilder 2 (standard). I am using the RandomAccessFile class to open the file and am accessing the same using the seek() method. I can read the strings by reading with readByte(), casting to a char then concatenating to reconstitue the string - works fine. Unfortunately thats all I can read - when I use .readInt() to read a 4 byte int or an .readDouble() for an 8 byte double all I get is garbage. Is there something I am missing here? Any advise would be much appreciated. - Stranded programmer in the Great White North.
Technical Details
Message-ID:
<755po6$ojs2@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,db8922f63d0c85da,start X-Google-Attributes: gidf74b3,public From: "Gary Irwin" <gary@agm.on.ca> Subject: Newbie having trouble reading random access binary data file Date: 1998/12/15 Message-ID: <755po6$ojs2@forums.borland.com> X-Deja-AN: 422492138 Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: borland.public.jbuilder.java.language