org.geotools.data.shapefile.indexed
Class IndexedFidReader

java.lang.Object
  extended byorg.geotools.data.shapefile.indexed.IndexedFidReader
All Implemented Interfaces:
FIDReader

public class IndexedFidReader
extends java.lang.Object
implements FIDReader

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

Author:
Jesse

Constructor Summary
IndexedFidReader(java.lang.String typeName, IndexedShapefileDataStore.Reader reader, java.nio.channels.ReadableByteChannel readChannel)
           
IndexedFidReader(java.lang.String typeName, java.nio.channels.ReadableByteChannel readChannel)
           
 
Method Summary
 void close()
          Release any resources associated with this reader
 int currentIndex()
          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(java.lang.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.
 int getRemoves()
          Returns the number of features that have been removed since the fid index was regenerated.
 void goTo(long recno)
          move the reader to the recno-th entry in the file.
 boolean hasNext()
          Returns whether another fid exists for this reader.
 java.lang.String next()
          Gets the next FID from the Reader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexedFidReader

public IndexedFidReader(java.lang.String typeName,
                        java.nio.channels.ReadableByteChannel readChannel)
                 throws java.io.IOException

IndexedFidReader

public IndexedFidReader(java.lang.String typeName,
                        IndexedShapefileDataStore.Reader reader,
                        java.nio.channels.ReadableByteChannel readChannel)
                 throws java.io.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(java.lang.String fid)
             throws java.io.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:
java.io.IOException
java.lang.IllegalArgumentException - DOCUMENT ME!

goTo

public void goTo(long recno)
          throws java.io.IOException
move the reader to the recno-th entry in the file.

Parameters:
recno -
Throws:
java.io.IOException

close

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

Specified by:
close in interface FIDReader
Throws:
java.io.IOException

hasNext

public boolean hasNext()
                throws java.io.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:
java.io.IOException

next

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

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

currentIndex

public int currentIndex()
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:
java.util.NoSuchElementException - DOCUMENT ME!


Copyright © GeoTools. All Rights Reserved.