org.geotools.data.shapefile.indexed.attribute
Class AttributeIndexSummary

java.lang.Object
  extended by org.geotools.data.shapefile.indexed.attribute.AttributeIndexSummary

public class AttributeIndexSummary
extends java.lang.Object

Class to manage a summary for attribute indexes.

It's just map that associates attribute name with index file. Using the name instead of its position on dbf permits to abstract from position, so attribute order can change with no influence on indexes.

Author:
Manuele Ventoruzzo

Field Summary
protected  int cacheSize
           
static int DEFAULT_CACHE_SIZE
           
protected  java.lang.String filename
           
static java.lang.String INDEX_EXT
           
static java.text.DecimalFormat SUFFIX
           
static java.lang.String SUMMARY_EXT
           
protected  java.net.URL summaryURL
          Url of summary file
 
Constructor Summary
AttributeIndexSummary(java.net.URL shpURL)
          Creates an IndexSummary
AttributeIndexSummary(java.net.URL shpURL, int cacheSize)
          Creates an IndexSummary
 
Method Summary
protected  void addIndex(java.lang.String attribute)
           
 void createIndex(java.lang.String attribute)
          Index creation.
 boolean existsIndex(java.lang.String attribute)
          Tests whether an index for this attribute exists.
protected  java.nio.channels.FileChannel getDBFChannel()
           
 AttributeIndexReader getIndex(java.lang.String attribute)
          Returns the index for specified attribute
protected  java.net.URL getIndexURL(java.lang.String attribute)
          Returns the index URL for specified attribute
 boolean hasIndex(java.lang.String attribute)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUMMARY_EXT

public static final java.lang.String SUMMARY_EXT
See Also:
Constant Field Values

INDEX_EXT

public static final java.lang.String INDEX_EXT
See Also:
Constant Field Values

SUFFIX

public static final java.text.DecimalFormat SUFFIX

DEFAULT_CACHE_SIZE

public static final int DEFAULT_CACHE_SIZE
See Also:
Constant Field Values

summaryURL

protected java.net.URL summaryURL
Url of summary file


filename

protected java.lang.String filename

cacheSize

protected int cacheSize
Constructor Detail

AttributeIndexSummary

public AttributeIndexSummary(java.net.URL shpURL)
                      throws java.net.MalformedURLException,
                             java.io.IOException
Creates an IndexSummary

Parameters:
shapefileUrl - url of shapefile for wich indexes are related to
Throws:
java.net.MalformedURLException
java.io.IOException

AttributeIndexSummary

public AttributeIndexSummary(java.net.URL shpURL,
                             int cacheSize)
                      throws java.net.MalformedURLException,
                             java.io.IOException
Creates an IndexSummary

Parameters:
shapefileUrl - url of shapefile for wich indexes are related to
cacheSize - maximum amount of memory to be used for index creation
Throws:
java.net.MalformedURLException
java.io.IOException
Method Detail

createIndex

public void createIndex(java.lang.String attribute)
                 throws java.io.FileNotFoundException,
                        java.io.IOException
Index creation. Adds attribute name to summary and invokes attribute index creation.

Parameters:
attribute -
Throws:
java.io.FileNotFoundException
java.io.IOException

getIndex

public AttributeIndexReader getIndex(java.lang.String attribute)
                              throws java.io.FileNotFoundException,
                                     java.io.IOException
Returns the index for specified attribute

Parameters:
attribute - attribute to search for
Returns:
Index reader or null if such attribute doesn't have an index
Throws:
java.io.FileNotFoundException
java.io.IOException

hasIndex

public boolean hasIndex(java.lang.String attribute)
                 throws java.io.FileNotFoundException,
                        java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

existsIndex

public boolean existsIndex(java.lang.String attribute)
                    throws java.io.FileNotFoundException,
                           java.io.IOException
Tests whether an index for this attribute exists.

Parameters:
attribute -
Returns:
Throws:
java.io.FileNotFoundException
java.io.IOException

getIndexURL

protected java.net.URL getIndexURL(java.lang.String attribute)
                            throws java.io.FileNotFoundException,
                                   java.io.IOException
Returns the index URL for specified attribute

Parameters:
attribute - attribute to search for
Returns:
URL to index file or null if such attribute doesn't have an index
Throws:
java.io.FileNotFoundException
java.io.IOException

addIndex

protected void addIndex(java.lang.String attribute)
                 throws java.io.FileNotFoundException,
                        java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

getDBFChannel

protected java.nio.channels.FileChannel getDBFChannel()
                                               throws java.io.FileNotFoundException,
                                                      java.net.MalformedURLException
Throws:
java.io.FileNotFoundException
java.net.MalformedURLException


Copyright © 1996-2010 Geotools. All Rights Reserved.