public class OsmReader extends AbstractReader
Modifier and Type | Class and Description |
---|---|
static class |
OsmReader.Options
Options are used to change how the xml data is parsed.
|
private static class |
OsmReader.OsmParsingCanceledException
Exception thrown after user cancellation.
|
AbstractReader.BinaryParserWorker, AbstractReader.CommonReader, AbstractReader.NodeReader, AbstractReader.ParserWorker, AbstractReader.RelationReader, AbstractReader.WayReader
Modifier and Type | Field and Description |
---|---|
private static Set<String> |
COMMON_XML_ATTRIBUTES |
protected Collection<OsmReader.Options> |
options
The
OsmReader.Options to use when parsing the xml data |
protected XMLStreamReader |
parser |
cancel, ds, externalIdMap, relations, uploadChangeset, ways
Modifier | Constructor and Description |
---|---|
protected |
OsmReader()
constructor (for private and subclasses use only)
|
protected |
OsmReader(OsmReader.Options... options)
constructor (for private and subclasses use only)
|
Modifier and Type | Method and Description |
---|---|
protected DataSet |
doParseDataSet(InputStream source,
ProgressMonitor progressMonitor) |
private long |
getLong(String name) |
private void |
handleIllegalDataException(IllegalDataException e) |
protected void |
jumpToEnd() |
protected void |
jumpToEnd(boolean printWarning)
When cursor is at the start of an element, moves it to the end tag of that element.
|
protected void |
parse() |
private void |
parseBounds(String generator) |
private void |
parseChangeset(Long uploadChangesetId) |
static DataSet |
parseDataSet(InputStream source,
ProgressMonitor progressMonitor)
Parse the given input source and return the dataset.
|
static DataSet |
parseDataSet(InputStream source,
ProgressMonitor progressMonitor,
OsmReader.Options... options)
Parse the given input source and return the dataset.
|
private void |
parseError() |
protected Node |
parseNode() |
private void |
parseNodeTags(NodeData n) |
private void |
parseOsm() |
protected Relation |
parseRelation() |
private RelationMemberData |
parseRelationMember(RelationData r) |
private void |
parseRelationMembersAndTags(RelationData r,
Collection<RelationMemberData> members) |
private void |
parseRemark() |
protected void |
parseRoot() |
private void |
parseTag(Tagged t) |
protected void |
parseUnknown() |
protected void |
parseUnknown(boolean printWarning) |
protected Way |
parseWay() |
private long |
parseWayNode(WayData w) |
private void |
parseWayNodesAndTags(WayData w,
Collection<Long> nodeIds) |
private void |
readCommon(PrimitiveData current)
Read out the common attributes and put them into current OsmPrimitive.
|
protected void |
setParser(XMLStreamReader parser) |
protected void |
throwException(String msg) |
protected void |
throwException(String msg,
Throwable th) |
protected void |
throwException(Throwable th) |
buildPrimitive, callPostProcessors, deregisterPostprocessor, doParseDataSet, doParseDataSet, getDataSet, getLong, parseAction, parseBounds, parseChangeset, parseChangeset, parseDownloadPolicy, parseId, parseLocked, parseNode, parseNode, parseRelation, parseRelationMember, parseRelationMember, parseTag, parseTimestamp, parseUploadPolicy, parseUser, parseUser, parseVersion, parseVersion, parseVersion, parseVisible, parseWay, prepareDataSet, processChangesetAfterParsing, processNodesAfterParsing, processRelationsAfterParsing, processWaysAfterParsing, registerPostprocessor
protected XMLStreamReader parser
protected final Collection<OsmReader.Options> options
OsmReader.Options
to use when parsing the xml dataprivate static final Set<String> COMMON_XML_ATTRIBUTES
protected OsmReader()
protected OsmReader(OsmReader.Options... options)
options
- The options to use when reading dataparseDataSet(InputStream, ProgressMonitor)
protected void setParser(XMLStreamReader parser)
protected void throwException(Throwable th) throws XMLStreamException
XMLStreamException
protected void throwException(String msg, Throwable th) throws XMLStreamException
XMLStreamException
protected void throwException(String msg) throws XMLStreamException
XMLStreamException
protected void parse() throws XMLStreamException
XMLStreamException
protected void parseRoot() throws XMLStreamException
XMLStreamException
private void parseOsm() throws XMLStreamException
XMLStreamException
private void handleIllegalDataException(IllegalDataException e) throws XMLStreamException
XMLStreamException
private void parseError() throws XMLStreamException
XMLStreamException
private void parseRemark() throws XMLStreamException
XMLStreamException
private void parseBounds(String generator) throws XMLStreamException
XMLStreamException
protected Node parseNode() throws XMLStreamException
XMLStreamException
private void parseNodeTags(NodeData n) throws IllegalDataException
IllegalDataException
protected Way parseWay() throws XMLStreamException
XMLStreamException
private void parseWayNodesAndTags(WayData w, Collection<Long> nodeIds) throws IllegalDataException
IllegalDataException
private long parseWayNode(WayData w) throws XMLStreamException
XMLStreamException
protected Relation parseRelation() throws XMLStreamException
XMLStreamException
private void parseRelationMembersAndTags(RelationData r, Collection<RelationMemberData> members) throws IllegalDataException
IllegalDataException
private RelationMemberData parseRelationMember(RelationData r) throws XMLStreamException
XMLStreamException
private void parseChangeset(Long uploadChangesetId) throws XMLStreamException
XMLStreamException
private void parseTag(Tagged t) throws XMLStreamException
XMLStreamException
protected void parseUnknown(boolean printWarning) throws XMLStreamException
XMLStreamException
protected void parseUnknown() throws XMLStreamException
XMLStreamException
protected final void jumpToEnd(boolean printWarning) throws XMLStreamException
printWarning
- if true
, a warning message will be printed if an unknown element is metXMLStreamException
- if there is an error processing the underlying XML sourceprotected final void jumpToEnd() throws XMLStreamException
XMLStreamException
private void readCommon(PrimitiveData current) throws IllegalDataException
current
- primitive to updateIllegalDataException
- if there is an error processing the underlying XML sourceprivate long getLong(String name) throws XMLStreamException
XMLStreamException
protected DataSet doParseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException
doParseDataSet
in class AbstractReader
IllegalDataException
public static DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException
source
- the source input stream. Must not be null.progressMonitor
- the progress monitor. If null, NullProgressMonitor.INSTANCE
is assumedIllegalDataException
- if an error was found while parsing the data from the sourceIllegalArgumentException
- if source is nullpublic static DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor, OsmReader.Options... options) throws IllegalDataException
source
- the source input stream. Must not be null.progressMonitor
- the progress monitor. If null, NullProgressMonitor.INSTANCE
is assumedoptions
- The options to use when parsing the datasetIllegalDataException
- if an error was found while parsing the data from the sourceIllegalArgumentException
- if source is null