org.geotools.data.shapefile.indexed
Class IndexedFidReader

Object
  extended by IndexedFidReader
All Implemented Interfaces:
FIDReader, FileReader

public class IndexedFidReader
extends Object
implements FIDReader, FileReader

This object reads from a file the fid of a feature in a shapefile.

Author:
Jesse
Module:
modules/plugin/shapefile (gt-shapefile.jar)

Constructor Summary
IndexedFidReader(ShpFiles shpFiles)
           
IndexedFidReader(ShpFiles shpFiles, ReadableByteChannel in)
           
IndexedFidReader(ShpFiles shpFiles, RecordNumberTracker reader)
           
 
Method Summary
 void close()
          Release any resources associated with this reader
 int currentSHXIndex()
          Returns the record number of the feature in the shx or shp that is identified by the the last fid returned by next().
 long findFid(String fid)
          Returns the offset to the location in the SHX file that the fid identifies.
 long getCount()
          Returns the number of Fid Entries in the file.
 long getCurrentFIDIndex()
          Returns the index that is appended to the typename to construct the fid.
 int getRemoves()
          Returns the number of features that have been removed since the fid index was regenerated.
 void goTo(long recno)
           
 boolean hasNext()
          Returns whether another fid exists for this reader.
 String id()
          An id for the reader.
 String next()
          Gets the next FID from the Reader.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexedFidReader

public IndexedFidReader(ShpFiles shpFiles)
                 throws IOException
Throws:
IOException

IndexedFidReader

public IndexedFidReader(ShpFiles shpFiles,
                        RecordNumberTracker reader)
                 throws IOException
Throws:
IOException

IndexedFidReader

public IndexedFidReader(ShpFiles shpFiles,
                        ReadableByteChannel in)
                 throws IOException
Throws:
IOException
Method Detail

getCount

public long getCount()
Returns the number of Fid Entries in the file.

Returns:
Returns the number of Fid Entries in the file.

getRemoves

public int getRemoves()
Returns the number of features that have been removed since the fid index was regenerated.

Returns:
Returns the number of features that have been removed since the fid index was regenerated.

findFid

public long findFid(String fid)
             throws IOException
Returns the offset to the location in the SHX file that the fid identifies. This search take logN time.

Parameters:
fid - the fid to find.
Returns:
Returns the record number of the record in the SHX file that the fid identifies. Will return -1 if the fid was not found.
Throws:
IOException
IllegalArgumentException - DOCUMENT ME!

goTo

public void goTo(long recno)
          throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: FIDReader
Release any resources associated with this reader

Specified by:
close in interface FIDReader
Throws:
IOException

hasNext

public boolean hasNext()
                throws IOException
Description copied from interface: FIDReader
Returns whether another fid exists for this reader.

Specified by:
hasNext in interface FIDReader
Returns:
true if more content exists
Throws:
IOException

next

public String next()
            throws IOException
Description copied from interface: FIDReader
Gets the next FID from the Reader.

Specified by:
next in interface FIDReader
Returns:
Next featureID
Throws:
IOException

currentSHXIndex

public int currentSHXIndex()
Returns the record number of the feature in the shx or shp that is identified by the the last fid returned by next().

Returns:
Returns the record number of the feature in the shx or shp that is identified by the the last fid returned by next().
Throws:
NoSuchElementException - DOCUMENT ME!

getCurrentFIDIndex

public long getCurrentFIDIndex()
Returns the index that is appended to the typename to construct the fid.

Returns:
the index that is appended to the typename to construct the fid.

id

public String id()
Description copied from interface: FileReader
An id for the reader. This is only used for debugging.

Specified by:
id in interface FileReader
Returns:
id for the reader.


Copyright © 1996-2010 Geotools. All Rights Reserved.