org.geotools.data
Interface FeatureReader<T extends FeatureType,F extends Feature>

All Known Subinterfaces:
DelegatingFeatureReader<T,F>
All Known Implementing Classes:
ArcSDEFeatureReader, CollectionFeatureReader, DefaultFeatureReader, DelegateFeatureReader, DiffFeatureReader, EmptyFeatureReader, FCBuffer, FIDFeatureReader, FilteringFeatureReader, ForceCoordinateSystemFeatureReader, JDBCClosingFeatureReader, JDBCFeatureReader, JDBCFeatureReader, JDBCInsertFeatureWriter, JDBCUpdateFeatureWriter, JDBCUpdateInsertFeatureWriter, MapServerWFSStrategy.MapServerWFSFeatureReader, MaxFeatureReader, PreGeneralizedFeatureReader, PropertyFeatureReader, ReprojectFeatureReader, ReTypeFeatureReader, WFSFeatureReader

public interface FeatureReader<T extends FeatureType,F extends Feature>

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

Author:
Ian Schneider, Sean Geoghegan, Defence Science and Technology Organisation.
Module:
modules/library/api (gt-api.jar)

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

Method Detail

getFeatureType

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

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

next

F next()
                       throws IOException,
                              IllegalArgumentException,
                              NoSuchElementException
Reads the next Feature in the FeatureReader.

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

hasNext

boolean hasNext()
                throws 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:
IOException - If an error occurs determining if there are more Features.

close

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

Throws:
IOException - DOCUMENT ME!


Copyright © 1996-2010 Geotools. All Rights Reserved.