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

Object
  extended by AttributeIndexSummary

public class AttributeIndexSummary
extends 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  String filename
           
static String INDEX_EXT
           
static DecimalFormat SUFFIX
           
static String SUMMARY_EXT
           
protected  URL summaryURL
          Url of summary file
 
Constructor Summary
AttributeIndexSummary(URL shpURL)
          Creates an IndexSummary
AttributeIndexSummary(URL shpURL, int cacheSize)
          Creates an IndexSummary
 
Method Summary
protected  void addIndex(String attribute)
           
 void createIndex(String attribute)
          Index creation.
 boolean existsIndex(String attribute)
          Tests whether an index for this attribute exists.
protected  FileChannel getDBFChannel()
           
 AttributeIndexReader getIndex(String attribute)
          Returns the index for specified attribute
protected  URL getIndexURL(String attribute)
          Returns the index URL for specified attribute
 boolean hasIndex(String attribute)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUMMARY_EXT

public static final String SUMMARY_EXT
See Also:
Constant Field Values

INDEX_EXT

public static final String INDEX_EXT
See Also:
Constant Field Values

SUFFIX

public static final DecimalFormat SUFFIX

DEFAULT_CACHE_SIZE

public static final int DEFAULT_CACHE_SIZE
See Also:
Constant Field Values

summaryURL

protected URL summaryURL
Url of summary file


filename

protected String filename

cacheSize

protected int cacheSize
Constructor Detail

AttributeIndexSummary

public AttributeIndexSummary(URL shpURL)
                      throws MalformedURLException,
                             IOException
Creates an IndexSummary

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

AttributeIndexSummary

public AttributeIndexSummary(URL shpURL,
                             int cacheSize)
                      throws MalformedURLException,
                             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:
MalformedURLException
IOException
Method Detail

createIndex

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

Parameters:
attribute -
Throws:
FileNotFoundException
IOException

getIndex

public AttributeIndexReader getIndex(String attribute)
                              throws FileNotFoundException,
                                     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:
FileNotFoundException
IOException

hasIndex

public boolean hasIndex(String attribute)
                 throws FileNotFoundException,
                        IOException
Throws:
FileNotFoundException
IOException

existsIndex

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

Parameters:
attribute -
Returns:
Throws:
FileNotFoundException
IOException

getIndexURL

protected URL getIndexURL(String attribute)
                   throws FileNotFoundException,
                          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:
FileNotFoundException
IOException

addIndex

protected void addIndex(String attribute)
                 throws FileNotFoundException,
                        IOException
Throws:
FileNotFoundException
IOException

getDBFChannel

protected FileChannel getDBFChannel()
                             throws FileNotFoundException,
                                    MalformedURLException
Throws:
FileNotFoundException
MalformedURLException


Copyright © 1996-2009 Geotools. All Rights Reserved.