There are a couple of things you can do. The first thing you might want
to try is to use the BufferedShapeLayer. It doesn't cache the
BinaryFile, but it does read in all the graphics from the file and
reuses them as they are needed on the screen. You do have to watch out
for memory usage for other, larger files.
<nod> The problem, I think, is in the data being repeatedly read across
the network, and that's what I was trying to avoid.
You can also store the overview map in a jar file for the ShapeLayer (or
for that matter, any other layer that uses the BinaryFile) to use, and
keep that on the client locally.
This is one that I hadn't thought of, but might work well... My only
concern is that it would increase the initial download time dramatically -
getting the download into the application would at least get initial
response for the user, and the larger file could be downloaded in the
background.
Nope, there is no caching going on for the default ShapeLayer.
I love being right ;) ;)
It depends on the location of the file, because that depends on how the
BinaryFile reads it. If it's a local file, the file is accessed with a
reusable RandomAccessFile. If the file is remote, it's likely closed
and reopened to parse the file at a point earlier than when it was last
read.
That is exactly what was happening, after I spent a little more time
looking at it.
I actually went and modified the URLStreamReader, since that seemed to be
the lowest level/simplest to work with. Basically I pulled the entire file
down into a byte array, then returned a ByteArrayInputStream rather than the
current URL Input Stream... So it basically downloads it once, then any
further requests come from the cached data. It proved very effective at
solving the problem, and with a minimal amount of effort.
The only potential problem is that it doesn't check to see if the data
file has changed... A quick (though not entirely accurate) check could be
done to see if the size has changed... Alternately, parameters could be
added as to whether or not to use the caching, and perhaps an additional
method to force a reload of the cache.
I've got a little more cleanup to do (at the moment this blocks while the
download is occurring, which I plan to move to a side-thread once I figure
out exactly what the ByteArrayInputStream will do in that case ;) but I'd
happily contribute the mods I made for future use, as minor as they are.
Thanks for the help, I'm sure I'll have more questions in the future.
Kevin E. Allen, SSgt, USAF
Air Force Information Warfare Center, IOASI
Database Applications Developer
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Wed Aug 1 14:55:09 2001
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:31 EDT