
I've investigated doing this in the past however it's very tricky to do correctly without having a huge impact on performance and/or memory requirements. I do have one idea that might work without too much slowdown. If I was to build up a big disk index of all nodes (there is already a disk cache of node details, but it's not currently indexed), I could then lookup all nodes that weren't found in the current tile and write them out too. It's a reasonable amount of work to build the b-tree index efficiently but it's sort-of on the todo list already anyway since I'm aware of other uses for something like this too.
You know that there are free implementations for b-trees? Look e.g. at http://bplusdotnet.sourceforge.net/ which offers you a java class, which includes storage to a file stream. Regards, Johann