This week's book giveaway is in the Other Open Source APIs forum. We're giving away four copies of Storm Applied and have Sean Allen, Peter Pathirana & Matthew Jankowski on-line! See this thread for details.
in DBMain i have to implement the method:
public String read(int recNo) throws RecordNotFoundException;
but it expects a int recNo. How i can get this value?
In File Description don't have a field named idRec. What do i?
Julio Cesar Lopes Marques
Sun Certified Java Developer 5, Sun Certified Java Programmer 5
One more thing i need to use headers and schema from db file to recovery data or i can jump to data section (pos 71 in my case) directly and slice parts to get data? I think that using the entire file is the right, but i think i don't need write a generic .db file reader but a db-2x1.db reader in this case i'll lost my time parsing headers and schema.
You can decide that. For instance, you can decide to read the db schema "on the fly", or you can hardcode it. I myself hardcoded it. I know others created a way to read it dynamically. Just remember to justify your decision in the end!
I'm one of those that created a way to read it dynamically and that's not that hard. main advantage of this approach: you could use the data-class for other files having a similar data-structure but of course this isn't a requirement for the assignment, so you don't have to do it.
whatever you choose, justify in choices.txt because for many things there is no right or wrong if you have a valid argumentation for doing it that particular way
if you have a dynamic db-schema you can handle e.g. changes in field lengths without changing your data-class (if header info is updated appropriately of course). you could even handle a file where a column is added or removed without altering your Data-class (the business logic should be changed of course)