Git Product home page Git Product logo

Comments (1)

wescleveland56 avatar wescleveland56 commented on July 18, 2024

I am having the same problem. I have a program that reads any .dbf file and dynamically copies data based on the meta data for that file. It knows nothing about the data within the file. It can read MANY (20+) Visual FoxPro1 files just fine. But there are 2 files that are defined identically that when it reads the first record, the first 232 bytes of the record contain 0x00 followed by the data that I expected to see at the beginning of the record. when it reads the second record, the first 232 bytes are the tail end of the first record. It appears that the offset for the data being read is not correct.

It turns out that there are 232 bytes between the header record terminator byte (0x0D) and the beginning of the first record.

After opening the file, all of the meta data seems correct to me.

The file contains:
00000000 : 30 11 04 16 66 00 00 00 E8 20 21 06 00 00 00 00
00000010 : 00 00 00 00 00 00 00 00 00 00 00 00 01 03 00 00
00000020 : 49 4E 44 43 4F 44 45 00 00 00 00 43 01 00 00 00
:
00001FC0 : 49 4E 44 43 4F 44 45 00 00 00 00 43 01 00 00 00
00001FD0 : 20 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00
00001FE0 : 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00001FF0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
: same to
000020E0 : 00 00 00 00 00 00 00 00 20 30 31 30 33 20 32 31

After opening the file DbfMetadata contains:

  • type VisualFoxPro1
  • recordsQty 102
  • fullHeaderLength 8424
  • oneRecordLength 1569

All of the above are exactly as I expect. But, when I read the first record, the first 232 bytes contain 0x00 followed by the data that is at offset 0x20E8 into the file (0x20 0x30 0x31 0x30 0x33 0x20 0x32 0x31).

For those experiencing this same problem, here is my temporary workaround:

// Setup the file as usual
File dbfFile = new File( dbfPath + table + ".dbf" );
InputStream tblDbf = new FileInputStream( dbfFile );
DbfReader tblReader = new DbfReader( tblDbf );
// Bad record workaround
tblReader.read();
tblReader.findFirstRecord();

from jdbf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.