My understanding that after reading the feild names then there should be record values so when I use readByte from the 7th byte , it does not give me desired results: DB file is :
Start of file 4 byte numeric, magic cookie value. Identifies this as a data file 2 byte numeric, number of fields in each record
Schema description section. Repeated for each field in a record: 1 byte numeric, length in bytes of field name n bytes (defined by previous entry), field name 1 byte numeric, field length in bytes end of repeating block
Data section. Repeat to end of file: 1 byte flag. 00 implies valid record, 0xFF implies deleted record Record containing fields in order specified in schema section, no separators between fields, each field fixed length at maximum specified in schema information
But what is bufferstore? as you are still reading records from your randomaccessfile (in) object? so it's not clear what you are iterating.
The read(byte b) method returns -1 if there is no more data or then end of file is reached, so you could loop through the records until you reach the end and remove the need for your iterator, which I think complicates the mechanism.
Otherwise I think you are almost there, you just need to split the record byte array into individual fields before converting to strings.
Jason [ August 10, 2007: Message edited by: Jason Moors ]
Now there is last problem left there is a box I am getting in the out put where every record start. I know the reason which is 1 byte flag. 00 implies valid record, 0xFF implies deleted record , according to the data file . I am just thinking how to read this byte so it does not show in the output. Any suggestions? Also please advice , am I on the right track?
can anyone tell me that following checking valid or deleted flag is correct or not? my out put is correct no problem. just want to confirm. (2 byte flag. 00 implies valid record, 0x8000 implies deleted record)