|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface FeatureInputStream
Provides streaming access to Feature objects provide by a source.
The primary means of accessing the individual result features is to use the Iterable.iterator() method and
subsequently call it's Iterator.next() methods. Depending on the implementation (e.g. when backed by an SQL
result set), this enables the processing of arbitrary large numbers of results without causing memory issues. Also,
it's essential to ensure that the close() method is called afterwards, or resource leaks may occur (e.g.
open SQL result sets).
A safe use of a FeatureInputStream looks like this:
...
FeatureInputStream fis = null;
try {
// retrieve the FeatureInputStream
fis = ...
for ( Feature f : fis ) {
// do something with the feature
// ...
}
} finally {
// make sure that the FeatureResultSet always gets closed
if ( fis != null ) {
rs.close();
}
}
...
| Method Summary | |
|---|---|
void |
close()
Must be invoked after using to close underlying resources, e.g. |
int |
count()
Counts the remaining features in the stream (and consumes them) and closes it. |
FeatureCollection |
toCollection()
Returns all members of the FeatureInputStream as a FeatureCollection. |
| Methods inherited from interface java.lang.Iterable |
|---|
iterator |
| Method Detail |
|---|
void close()
ResultSets.
FeatureCollection toCollection()
FeatureInputStream as a FeatureCollection.
NOTE: This method should not be called for very large result sets, as it introduces the overhead of keeping all
created feature instances in memory. The returned collection will contain all Features instances from the
current position in the iteration sequence.
nullint count()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||