public interface FeatureReader<T extends FeatureType,F extends Feature> extends Closeable
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){
}
}
}
Modifier and Type | Method and Description |
---|---|
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.
|
T getFeatureType()
F next() throws IOException, IllegalArgumentException, NoSuchElementException
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
boolean hasNext() throws IOException
IOException
- If an error occurs determining if there are more Features.void close() throws IOException
close
in interface AutoCloseable
close
in interface Closeable
IOException
- if an I/O error occursCopyright © 1996–2019 Geotools. All rights reserved.