Open cooldemo opened 9 years ago
I think, I have the same problem. When I'm trying to open file, I have "Table 'xx.dbf' has become corrupted. Table will need to be repaired before using again"
I think smth wrong with this:
private void writeHeader() throws IOException { byte[] bytes = DbfMetadataUtils.toByteArrayHeader(metadata); // assert(bytes.length == 16); out.write(bytes); BitUtils.memset(bytes, 0); out.write(bytes);
Hi, I have made quite a few changes to it. I don't know if you will be able to create new files, but it should work on appending to existing files as well as reading them.
I have attached fixed sources and part of my code as an example how to use it.
Thank you alot!!!
I found the main reason.
It's necessary to add number of rows and maybe necessary , I'm not sure, to add the date.
You do it in your example here:
dbfMetaFakvy.setRecordsQty(billCount); dbfMetaFakvy.setUpdateDate(Calendar.getInstance().getTime());
The writes to a dbf file are broken - header is not written properly.