* <code>UnsupportedOperationException</code> will be thrown.
*
* @see org.geotools.index.quadtree.IndexStore#load()
*/
public QuadTree load(IndexFile indexfile, boolean useMemoryMapping) throws StoreException {
QuadTree tree = null;
try {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest("Opening QuadTree "
+ this.file.getCanonicalPath());
}
final FileInputStream fis = new FileInputStream(file);
final FileChannel channel = fis.getChannel();
IndexHeader header = new IndexHeader(channel);
ByteOrder order = byteToOrder(header.getByteOrder());
ByteBuffer buf = ByteBuffer.allocate(8);
buf.order(order);
channel.read(buf);
buf.flip();
tree = new QuadTree(buf.getInt(), buf.getInt(), indexfile) {
public void insert(int recno, Envelope bounds) {
throw new UnsupportedOperationException(
"File quadtrees are immutable");
}
public boolean trim() {
return false;
}
public void close() throws StoreException {
super.close();
try {
channel.close();
fis.close();
} catch (IOException e) {
throw new StoreException(e);
}
}
};
tree.setRoot(FileSystemNode.readNode(0, null, channel, order, useMemoryMapping));
LOGGER.finest("QuadTree opened");
} catch (IOException e) {
throw new StoreException(e);
}