• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: could anybody help me whith .db file?

 
Wilder C Rodrigues
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
I have many problems.
I'm not getting the data in .db file.
I'd read a lot of materials and saw examples too. But I'm using a "for" to check my .db file, but the EOFException is thrown.
Please, give me an example, just a little example.
Thanks a lot.
Wilder C. Rodrigues,
Sun Certified Programmer for Java 2
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Wilder,
You havent mentioned which assignment you are looking at (there are 2 NX assigments, and I vaguely remember someone downloading the old assignment after the new assignments started appearing), so there is at least a 50% chance that whatever anyone posts wont help yout.
[Off topic question to the bartenders: instead of NX: in the headings, would it be better to have "FBNS", "HTL", or "CTX" in the headings? And no mnemonic for general issues? Otherwise we could get to a point 12 months from now where every post starts with "NX" and newcommers are confused.)
Back on topic: There is also the problem that many people here do not want to post code or offer "definitive" methods of achieving a solution until after they see what the original poster is trying to achieve - it is no good me telling you my way of doing the assignment, as you will not have thought about the alternatives, so you will not be able to argue why you did your assignment your way in the exam.
I think the best step forward for you would be to write a test application - all it should do is try and read the file, putting data out using System.out.println() statements. Do not attempt to do any GUI or anything else with this. One step at a time. If the code doesnt work, then you have one small program that you can post here, and people can look at and help you with.
Regards, Andrew
 
Nick Lee
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Wilder,
I don't know what do u mean exactly.
And the method to read the file is just readInt(),readUTF() and read(),and controll the file pointer.What else do u wanna know?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Study the information contained in the header carefully. It's possible to figure out exactly how many records there are, how long they are, and where each one begins - long before you reach the end of the file. Don't forget you can use File's length() method. If you design your code well you will never see an EOF, because you'll never need to attempt to read any bytes after the EOF.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic