Package org.openstreetmap.josm.io
Class NoteReader
- java.lang.Object
-
- org.openstreetmap.josm.io.NoteReader
-
public class NoteReader extends 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 InputSource
inputSource
private List<Note>
parsedNotes
-
Constructor Summary
Constructors Constructor Description NoteReader(InputStream source)
Initializes the reader with a given InputStreamNoteReader(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 List<Note>
parse()
Parses the InputStream given to the constructor and returns the resulting Note objects(package private) static LatLon
parseLatLon(UnaryOperator<String> attrs)
(package private) static Note
parseNoteBasic(UnaryOperator<String> attrs)
(package private) static Note
parseNoteBasic(Attributes attrs)
(package private) static Note
parseNoteFull(UnaryOperator<String> attrs)
(package private) static Note
parseNoteFull(Attributes attrs)
-
-
-
Field Detail
-
inputSource
private final InputSource inputSource
-
parsedNotes
private List<Note> parsedNotes
-
-
Constructor Detail
-
NoteReader
public NoteReader(InputStream source)
Initializes the reader with a given InputStream- Parameters:
source
- - InputStream containing Notes XML
-
NoteReader
public NoteReader(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(UnaryOperator<String> attrs)
-
parseNoteBasic
static Note parseNoteBasic(Attributes attrs)
-
parseNoteBasic
static Note parseNoteBasic(UnaryOperator<String> attrs)
-
parseNoteFull
static Note parseNoteFull(Attributes attrs)
-
parseNoteFull
static Note parseNoteFull(UnaryOperator<String> attrs)
-
parse
public List<Note> parse() throws SAXException, IOException
Parses the InputStream given to the constructor and returns the resulting Note objects- Returns:
- List of Notes parsed from the input data
- Throws:
SAXException
- if any SAX parsing error occursIOException
- if any I/O error occurs
-
-