iryndin / jdbf

Java utility to read/write DBF files
108 stars 77 forks source link

Add ability to read MEMO files to the new JDBF 3.0 #10

Open iryndin opened 9 years ago

hrj commented 9 years ago

Hi @iryndin

I got an exception while reading a MEMO, from a .FPT file:

Exception in thread "main" java.io.IOException: Resetting to invalid mark
    at java.io.BufferedInputStream.reset(BufferedInputStream.java:448)
    at net.iryndin.jdbf.reader.MemoReader.read(Unknown Source)
    at net.iryndin.jdbf.core.DbfRecord.getMemoAsString(Unknown Source)
    at net.iryndin.jdbf.core.DbfRecord.getMemoAsString(Unknown Source)

I see that you have a v3.0 branch in which there are some commits related to MEMO fields. Is that branch stable enough for production use?

hrj commented 9 years ago

Just FYI, I tried the v3.0 branch on my DB, and it doesn't throw exceptions when reading the memo, but it doesn't return correct results for memos. The returned strings are one or two letter unicode characters, which I know are wrong because other tools are able to read the memos correctly.

I can't send you a test-case, because my DB is large and contains third-party details. I also don't have FoxPro to create a database of my own.

However, I can help debug this. For example, I could send the header bytes or debug logs.

hrj commented 9 years ago

Oh hey, scratch what I said.

I was using getString() to read the memo field. Using new String(getBytes()) works fine.

Sorry for the prior noise.