public class OsmReader extends AbstractReader
| Modifier and Type | Class and Description |
|---|---|
private static class |
OsmReader.OsmParsingCanceledException
Exception thrown after user cancelation.
|
private static class |
OsmReader.OsmParsingException |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
cancel |
protected XMLStreamReader |
parser |
private static List<OsmServerReadPostprocessor> |
postprocessors
Used by plugins to register themselves as data postprocessors.
|
ds, externalIdMap, relations, uploadChangeset, ways| Modifier | Constructor and Description |
|---|---|
protected |
OsmReader()
constructor (for private and subclasses use only)
|
| Modifier and Type | Method and Description |
|---|---|
private User |
createUser(String uid,
String name) |
static void |
deregisterPostprocessor(OsmServerReadPostprocessor pp)
Deregister a postprocessor previously registered with
registerPostprocessor(org.openstreetmap.josm.io.OsmServerReadPostprocessor). |
protected DataSet |
doParseDataSet(InputStream source,
ProgressMonitor progressMonitor) |
private long |
getLong(String name) |
private void |
jumpToEnd() |
private 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.
|
protected Node |
parseNode() |
private void |
parseOsm() |
protected Relation |
parseRelation() |
private RelationMemberData |
parseRelationMember(Relation r) |
protected void |
parseRoot() |
private void |
parseTag(Tagged t) |
protected void |
parseUnknown() |
protected void |
parseUnknown(boolean printWarning) |
protected Way |
parseWay() |
private long |
parseWayNode(Way w) |
private void |
readCommon(PrimitiveData current)
Read out the common attributes and put them into current OsmPrimitive.
|
static void |
registerPostprocessor(OsmServerReadPostprocessor pp)
Register a new postprocessor.
|
protected void |
setParser(XMLStreamReader parser) |
protected void |
throwException(String msg) |
protected void |
throwException(String msg,
Throwable th) |
getDataSet, prepareDataSet, processChangesetAfterParsing, processNodesAfterParsing, processRelationsAfterParsing, processWaysAfterParsingprotected XMLStreamReader parser
protected boolean cancel
private static volatile List<OsmServerReadPostprocessor> postprocessors
protected OsmReader()
public static void registerPostprocessor(OsmServerReadPostprocessor pp)
pp - postprocessorderegisterPostprocessor(org.openstreetmap.josm.io.OsmServerReadPostprocessor)public static void deregisterPostprocessor(OsmServerReadPostprocessor pp)
registerPostprocessor(org.openstreetmap.josm.io.OsmServerReadPostprocessor).pp - postprocessorregisterPostprocessor(org.openstreetmap.josm.io.OsmServerReadPostprocessor)protected void setParser(XMLStreamReader parser)
protected void throwException(String msg, Throwable th) throws XMLStreamException
XMLStreamExceptionprotected void throwException(String msg) throws XMLStreamException
XMLStreamExceptionprotected void parse() throws XMLStreamException
XMLStreamExceptionprotected void parseRoot() throws XMLStreamException
XMLStreamExceptionprivate void parseOsm() throws XMLStreamException
XMLStreamExceptionprivate void parseBounds(String generator) throws XMLStreamException
XMLStreamExceptionprotected Node parseNode() throws XMLStreamException
XMLStreamExceptionprotected Way parseWay() throws XMLStreamException
XMLStreamExceptionprivate long parseWayNode(Way w) throws XMLStreamException
XMLStreamExceptionprotected Relation parseRelation() throws XMLStreamException
XMLStreamExceptionprivate RelationMemberData parseRelationMember(Relation r) throws XMLStreamException
XMLStreamExceptionprivate void parseChangeset(Long uploadChangesetId) throws XMLStreamException
XMLStreamExceptionprivate void parseTag(Tagged t) throws XMLStreamException
XMLStreamExceptionprotected void parseUnknown(boolean printWarning) throws XMLStreamException
XMLStreamExceptionprotected void parseUnknown() throws XMLStreamException
XMLStreamExceptionprivate 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 sourceprivate void jumpToEnd() throws XMLStreamException
XMLStreamExceptionprivate User createUser(String uid, String name) throws XMLStreamException
XMLStreamExceptionprivate void readCommon(PrimitiveData current) throws XMLStreamException
current - primitive to updateXMLStreamException - if there is an error processing the underlying XML sourceprivate long getLong(String name) throws XMLStreamException
XMLStreamExceptionprotected DataSet doParseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException
IllegalDataExceptionpublic 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 null