ShapefileDataStore not respecting useMemoryMappedBuffer flag
------------------------------------------------------------
Key: GEOT-1748
URL: http://jira.codehaus.org/browse/GEOT-1748
Project: GeoTools
Issue Type: Bug
Affects Versions: 2.4.0
Environment: Windows XP
Reporter: Enamul Haque
Observe the following piece of code:
{noformat}
ShapefileDataStore(someURL, false);
{noformat}
Despite the false flag, it'll continue using memory mapping because :
{noformat}
protected boolean useMemoryMappedBuffer = true;
public ShapefileDataStore(URL url,boolean useMemoryMappedBuffer) throws
java.net.MalformedURLException {
this(url, useMemoryMappedBuffer, DEFAULT_STRING_CHARSET);
}
public ShapefileDataStore(URL url,boolean useMemoryMappedBuffer, Charset
dbfCharset) throws java.net.MalformedURLException {
String filename = null;
shpURL = ShapefileDataStoreFactory.toShpURL(url);
dbfURL = ShapefileDataStoreFactory.toDbfURL(url);
shxURL = ShapefileDataStoreFactory.toShxURL(url);
prjURL = ShapefileDataStoreFactory.toPrjURL(url);
xmlURL = ShapefileDataStoreFactory.toXmlURL(url);
this.dbfCharset = dbfCharset;
}
{noformat}
As you can see, useMemoryMappedBuffer is set to true by default and is not
touched by these constructors. useMemoryMappedBuffer is used by
ShapefileRendererUtil:
{noformat}
public static IndexedDbaseFileReader getDBFReader( ShapefileDataStore ds )
throws IOException {
return new IndexedDbaseFileReader(ds.getReadChannel(ds.dbfURL),
ds.useMemoryMappedBuffer, ds.getStringCharset());
}
{noformat}
Sometimes you want to turn off memory mapping for huge files as geotools maps
the whole file into memory and at times gets you OutOfMemory error if the file
has a decent size.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel