Yesterday I sent this to user's list, but I think is most suitable here.
Note that I've created a patch which solves the problem, please have a
look at it.
I've been working on 2.5.x branch.

Original message:
----------

Hello list,
I'm writing a DBF file using a code like this:

 DbaseFileHeader header = getHeader();
 WritableByteChannel out = new FileOutputStream(filename).getChannel();
 DbaseFileWriter writer = new DbaseFileWriter(header, out);
 for (int i=0; i<NUMROWS; i++) {
   writer.write(getRow());
 }
 writer.close();

I'd expect that when I close the file, the number of registers gets
updated in the DBF header.

However, it seems that it is not actually updated and the header ends
with a value of 0 (zero) registers, which means that
DbaseFileReader.hasNext() will always return false for this file.

This is a pity, it means I can't write a proper DBF unless I know the
number of registers in advance.
Am I missing something here?

Regards,

César


-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   César Martínez Izquierdo
   GIS developer
   -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
   ETC-LUSI: http://etc-lusi.eionet.europa.eu/
   Universitat Autònoma de Barcelona (SPAIN)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Attachment: DbaseFileWriter.java.patch
Description: Binary data

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to