public class MaxFeatureReader<T extends FeatureType,F extends Feature> extends Object implements DelegatingFeatureReader<T,F>
Modifier and Type | Field and Description |
---|---|
protected int |
counter |
protected FeatureReader<T,F> |
featureReader |
protected int |
maxFeatures |
Constructor and Description |
---|
MaxFeatureReader(FeatureReader<T,F> featureReader,
int maxFeatures)
Creates a new instance of MaxFeatureReader
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Release the underlying resources associated with this stream.
|
FeatureReader<T,F> |
getDelegate() |
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.
|
protected final FeatureReader<T extends FeatureType,F extends Feature> featureReader
protected final int maxFeatures
protected int counter
public MaxFeatureReader(FeatureReader<T,F> featureReader, int maxFeatures)
featureReader
- FeatureReader being maxedmaxFeatures
- DOCUMENT ME!public FeatureReader<T,F> getDelegate()
getDelegate
in interface DelegatingFeatureReader<T extends FeatureType,F extends Feature>
public F next() throws IOException, IllegalAttributeException, NoSuchElementException
FeatureReader
next
in interface FeatureReader<T extends FeatureType,F extends Feature>
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.public void close() throws IOException
FeatureReader
close
in interface Closeable
close
in interface AutoCloseable
close
in interface FeatureReader<T extends FeatureType,F extends Feature>
IOException
- if an I/O error occurspublic T getFeatureType()
FeatureReader
getFeatureType
in interface FeatureReader<T extends FeatureType,F extends Feature>
public boolean hasNext() throws IOException
FeatureReader
hasNext
in interface FeatureReader<T extends FeatureType,F extends Feature>
true
if the featureReader has not passed the max and still has more
features.IOException
- If the reader we are filtering encounters a problemCopyright © 1996–2019 Geotools. All rights reserved.