public interface GeoEntryExtractor
GeoEntryExtractor
provides methods for extracting GeoEntry
objects from various
GeoNames resources.Modifier and Type | Interface and Description |
---|---|
static interface |
GeoEntryExtractor.ExtractionCallback
An
ExtractionCallback provides a method for receiving a GeoEntry object that
has been extracted from a resource. |
Modifier and Type | Method and Description |
---|---|
List<GeoEntry> |
getGeoEntries(String resource,
ProgressCallback progressCallback)
Extracts GeoNames entries from a resource as
GeoEntry objects, all at once, providing
updates about the extraction progress. |
void |
pushGeoEntriesToExtractionCallback(String resource,
GeoEntryExtractor.ExtractionCallback extractionCallback)
Extracts GeoNames entries from a resource as
GeoEntry objects and passes each GeoEntry object through the callback extractionCallback . |
void |
setUrl(String url)
Sets the url
|
void setUrl(String url)
url
- List<GeoEntry> getGeoEntries(String resource, ProgressCallback progressCallback) throws GeoEntryExtractionException, GeoNamesRemoteDownloadException
GeoEntry
objects, all at once, providing
updates about the extraction progress.resource
- the resource containing GeoNames entriesprogressCallback
- the callback to receive updates about the extraction progress, may be
null if you don't want any updatesGeoEntry
objects corresponding to the GeoNames entries in the
resourceGeoEntryExtractionException
- if an error occurs while extracting GeoNames entries from
the resourceGeoNamesRemoteDownloadException
- if an error occurs while downloading from the resourcevoid pushGeoEntriesToExtractionCallback(String resource, GeoEntryExtractor.ExtractionCallback extractionCallback) throws GeoEntryExtractionException, GeoNamesRemoteDownloadException
GeoEntry
objects and passes each GeoEntry
object through the callback extractionCallback
. The callback is called
exactly once for each GeoEntry
object extracted from the resource.
This method should be used instead of getGeoEntries(String, ProgressCallback)
if
the resource contains a very large number of entries.
resource
- the resource containing GeoNames entriesextractionCallback
- the callback that receives each extracted GeoEntry
object,
must not be nullIllegalArgumentException
- if extractionCallback
is nullGeoEntryExtractionException
- if an error occurs while extracting GeoNames entries from
the resourceGeoNamesRemoteDownloadException
- if an error occurs while downloading from the resourceThis work is licensed under a Creative Commons Attribution 4.0 International License.