iryndin / jdbf

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

The last record is read twice #3

Closed iryndin closed 10 years ago

iryndin commented 10 years ago

When I read my dbf, the last record always occurs twice

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.text.ParseException;
import net.iryndin.jdbf.core.DbfRecord;
import net.iryndin.jdbf.reader.DbfReader;

public class JDBFTest {
    public static void main(String[] args) throws IOException, ParseException {
        DbfRecord rec = null;
        DbfReader reader = new DbfReader( new File("./src/gds_im.dbf") );
        while( (rec = reader.read()) != null ) {
            rec.setStringCharset( Charset.forName("Cp866") );
            System.out.println( rec.toMap() );
        }
        reader.close();
    }
}

Check this and make only single read of the last record

iryndin commented 10 years ago

StackOverflow question is raised: http://stackoverflow.com/questions/24883297/the-last-record-reads-twice-when-reading-dbf-in-java-via-jdbf