On Thu, Aug 30, 2012 at 9:46 AM, Matthijs Laan <[email protected]>wrote:
>
> Doing the same with GeoTools code:
>
> FileChannel channel = null;
> try {
> channel = new FileInputStream(dbfPath).getChannel();
> DbaseFileHeader dheader = new DbaseFileHeader();
> ByteBuffer bb = channel.map(FileChannel.MapMode.READ_ONLY, 0,
> channel.size());
> dheader.readHeader(bb);
> return dheader.getNumRecords()
> } finally {
> if(channel != null) {
> channel.close();
> }
> }
>
Doing this is problematic, you should check the shx file, not the dbf one,
that's the file that contains the official size of the shapefile, the dbf
file
could contain more rows.
That said, 700ms is a massive amount of time, I've just tried against
a set of 21 dbf files and the _total_ time to get the feature count in each
was 33ms (a bit more than 1ms per file, that is).
See the attached file, which also makes sure we don't try to memory
map the whole file to just read the header
Cheers
Andrea
--
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
DBFHeaderReader.java
Description: Binary data
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
