Package org.openstreetmap.josm.io
Class NoteReader
- java.lang.Object
-
- org.openstreetmap.josm.io.NoteReader
-
public class NoteReader extends java.lang.Object
Class to read Note objects from their XML representation. It can take either API style XML which starts with an "osm" tag or a planet dump style XML which starts with an "osm-notes" tag.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
NoteReader.NoteParseMode
Notes can be represented in two XML formats.private class
NoteReader.Parser
SAX handler to read note information from its XML representation.
-
Field Summary
Fields Modifier and Type Field Description private org.xml.sax.InputSource
inputSource
private java.util.List<Note>
parsedNotes
-
Constructor Summary
Constructors Constructor Description NoteReader(java.io.InputStream source)
Initializes the reader with a given InputStreamNoteReader(java.lang.String source)
Initializes the reader with a string as a source
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Note>
parse()
Parses the InputStream given to the constructor and returns the resulting Note objects(package private) static LatLon
parseLatLon(java.util.function.UnaryOperator<java.lang.String> attrs)
(package private) static Note
parseNoteBasic(java.util.function.UnaryOperator<java.lang.String> attrs)
(package private) static Note
parseNoteBasic(org.xml.sax.Attributes attrs)
(package private) static Note
parseNoteFull(java.util.function.UnaryOperator<java.lang.String> attrs)
(package private) static Note
parseNoteFull(org.xml.sax.Attributes attrs)
-
-
-
Field Detail
-
inputSource
private final org.xml.sax.InputSource inputSource
-
parsedNotes
private java.util.List<Note> parsedNotes
-
-
Constructor Detail
-
NoteReader
public NoteReader(java.io.InputStream source)
Initializes the reader with a given InputStream- Parameters:
source
- - InputStream containing Notes XML
-
NoteReader
public NoteReader(java.lang.String source)
Initializes the reader with a string as a source- Parameters:
source
- UTF-8 string containing Notes XML to parse
-
-
Method Detail
-
parseLatLon
static LatLon parseLatLon(java.util.function.UnaryOperator<java.lang.String> attrs)
-
parseNoteBasic
static Note parseNoteBasic(org.xml.sax.Attributes attrs)
-
parseNoteBasic
static Note parseNoteBasic(java.util.function.UnaryOperator<java.lang.String> attrs)
-
parseNoteFull
static Note parseNoteFull(org.xml.sax.Attributes attrs)
-
parseNoteFull
static Note parseNoteFull(java.util.function.UnaryOperator<java.lang.String> attrs)
-
parse
public java.util.List<Note> parse() throws org.xml.sax.SAXException, java.io.IOException
Parses the InputStream given to the constructor and returns the resulting Note objects- Returns:
- List of Notes parsed from the input data
- Throws:
org.xml.sax.SAXException
- if any SAX parsing error occursjava.io.IOException
- if any I/O error occurs
-
-