Class HelpContentReader


  • public class HelpContentReader
    extends WikiReader
    Reads help content from the JOSM Wiki and prepares it for rendering in the internal help browser. The help content has to be filtered because only the main content <div> of a Wiki help page is displayed in the internal help browser. It also has to be transformed because the internal help browser required slightly different HTML than what is provided by the Wiki.
    • Constructor Summary

      Constructors 
      Constructor Description
      HelpContentReader​(java.lang.String baseUrl)
      Constructs a new HelpContentReader.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String fetchHelpTopicContent​(java.lang.String helpTopicUrl, boolean dotest)
      Fetches the content of a help topic from the JOSM wiki.
      protected java.lang.String prepareHelpContent​(java.io.BufferedReader in, boolean dotest, java.net.URL url)
      Reads help content from the input stream and prepares it to be rendered later in the internal help browser.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HelpContentReader

        public HelpContentReader​(java.lang.String baseUrl)
        Constructs a new HelpContentReader.
        Parameters:
        baseUrl - the base url of the JOSM help wiki, i.e. https://josm.openstreetmap.org
    • Method Detail

      • fetchHelpTopicContent

        public java.lang.String fetchHelpTopicContent​(java.lang.String helpTopicUrl,
                                                      boolean dotest)
                                               throws HelpContentReaderException
        Fetches the content of a help topic from the JOSM wiki.
        Parameters:
        helpTopicUrl - the absolute help topic URL
        dotest - if true, checks if help content is empty
        Returns:
        the content, filtered and transformed for being displayed in the internal help browser
        Throws:
        HelpContentReaderException - if problem occurs
        MissingHelpContentException - if this helpTopicUrl doesn't point to an existing Wiki help page
      • prepareHelpContent

        protected java.lang.String prepareHelpContent​(java.io.BufferedReader in,
                                                      boolean dotest,
                                                      java.net.URL url)
                                               throws HelpContentReaderException
        Reads help content from the input stream and prepares it to be rendered later in the internal help browser. Throws a MissingHelpContentException if the content read from the stream most likely represents a stub help page.
        Parameters:
        in - the input stream
        dotest - if true, checks if help content is empty
        url - help topic URL
        Returns:
        the content
        Throws:
        HelpContentReaderException - if an exception occurs
        MissingHelpContentException - if the content read isn't a help page
        Since:
        5936