I have a problem creating records of the same size in RandomAccessFile.
My objective is to read/write individual record in a RandomAccessFile by its order in the file.
For example, to read the 5th record, the command would be ReadObject(4 * RecordSize), where RecordSize is a constant.
The record has the following fields.
Although the fields have fixed size, I notice that the records stored in RandomAccessFile have different sizes depending on the actual content of Id although Id is declared as 5 bytes.
My question:
One solution for me is to append filler so all records are the same size.
To do that I must find out what is the maximum possible record size (compressed or not) given the fields I have.
Can the record size be calculated ?
(Note: SQL is not suitable for my application).
My objective is to read/write individual record in a RandomAccessFile by its order in the file.
For example, to read the 5th record, the command would be ReadObject(4 * RecordSize), where RecordSize is a constant.
The record has the following fields.
B4X:
Type REC_TYPE( _
Id(5) As Byte, _
Value As Double _
)
Although the fields have fixed size, I notice that the records stored in RandomAccessFile have different sizes depending on the actual content of Id although Id is declared as 5 bytes.
My question:
One solution for me is to append filler so all records are the same size.
To do that I must find out what is the maximum possible record size (compressed or not) given the fields I have.
Can the record size be calculated ?
(Note: SQL is not suitable for my application).