Thanks for your help guys. I opted for a combination of both your ideas
long fileSize = rAF.length();
if((fileSize-BYTES_BEFORE_DATA_SECTION)%(DELETE_FLAG_SIZE+recordLen) != ZERO){
throw new IOException("DATABASE CORRUPT!: Incorrect data format");
}
followed by
int rowCount = (int) (fileSize-BYTES_BEFORE_DATA)/(DELETE_FLAG_SIZE+recordLen);
while(rowCount > 0){
int deleted = rAF.read();
rAF.read(record);
rows.add(new String(record));
rowCount--;
}
I'm still discarding the deleted flag though. Something I need to think about
