Class 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 InputStream
      NoteReader​(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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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​(java.util.function.UnaryOperator<java.lang.String> attrs)
      • parseNoteFull

        static Note parseNoteFull​(java.util.function.UnaryOperator<java.lang.String> attrs)
      • parse

        public java.util.List<Noteparse()
                                   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 occurs
        java.io.IOException - if any I/O error occurs