org.geotools.data
Interface FeatureReader

All Known Implementing Classes:
CollectionFeatureReader, DefaultFeatureReader, DelegateFeatureReader, DiffFeatureReader, EmptyFeatureReader, FCBuffer, FIDFeatureReader, FilteringFeatureReader, ForceCoordinateSystemFeatureReader, JDBCFeatureReader, MaxFeatureReader, PropertyFeatureReader, ReprojectFeatureReader, ReTypeFeatureReader, TigerFeatureReader, VPFFeatureReader, VPFFileFeatureReader

public interface FeatureReader

The low-level interface for reading Features. Will use the underlying AttributeReader and the given FeatureType to create new Features.

Typical use is as follows:


   FeatureReader reader = null;
   try{
      for( reader = data.getFeatureReader( filter ); reader.hasNext(); ){
          f = reader.next();
          ...
      }
   }
   catch (IOException problem){
      ...
   }
   finally {
      if( reader != null ){
          try {
             reader.close();
          }
          catch( IOException eek){
          }
      }
   } 
 

Questions and Suggestions

Version:
$Id: FeatureReader.java 17702 2006-01-23 00:08:55Z desruisseaux $
Author:
Ian Schneider, Sean Geoghegan, Defence Science and Technology Organisation.

Method Summary
 void close()
          Release the underlying resources associated with this stream.
 FeatureType getFeatureType()
          Return the FeatureType this reader has been configured to create.
 boolean hasNext()
          Query whether this FeatureReader has another Feature.
 Feature next()
          Reads the next Feature in the FeatureReader.
 

Method Detail

getFeatureType

public FeatureType getFeatureType()
Return the FeatureType this reader has been configured to create.

Returns:
the FeatureType of the Features this FeatureReader will create.

next

public Feature next()
             throws java.io.IOException,
                    IllegalAttributeException,
                    java.util.NoSuchElementException
Reads the next Feature in the FeatureReader.

Returns:
The next feature in the reader.
Throws:
java.io.IOException - If an error occurs reading the Feature.
IllegalAttributeException - If the attributes read do not comply with the FeatureType.
java.util.NoSuchElementException - If there are no more Features in the Reader.

hasNext

public boolean hasNext()
                throws java.io.IOException
Query whether this FeatureReader has another Feature.

Returns:
True if there are more Features to be read. In other words, true if calls to next would return a feature rather than throwing an exception.
Throws:
java.io.IOException - If an error occurs determining if there are more Features.

close

public void close()
           throws java.io.IOException
Release the underlying resources associated with this stream.

Throws:
java.io.IOException - DOCUMENT ME!


Copyright © GeoTools. All Rights Reserved.