Package org.openstreetmap.josm.tools
Class WikiReader
- java.lang.Object
-
- org.openstreetmap.josm.tools.WikiReader
-
- Direct Known Subclasses:
HelpContentReader
public class WikiReader extends Object
Read a trac-wiki page.
-
-
Constructor Summary
Constructors Constructor Description WikiReader()
Constructs a newWikiReader
.WikiReader(String baseurl)
Constructs a newWikiReader
for the given base URL.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getBaseUrlWiki()
Returns the base URL of wiki.String
read(String url)
Read the page specified by the url and return the content.protected String
readFromTrac(BufferedReader in, URL url)
String
readLang(String text)
Reads the localized version of the given wiki page.private String
readLang(URL url)
private static String
readNormal(BufferedReader in, boolean html)
-
-
-
Constructor Detail
-
WikiReader
public WikiReader(String baseurl)
Constructs a newWikiReader
for the given base URL.- Parameters:
baseurl
- The wiki base URL
-
WikiReader
public WikiReader()
Constructs a newWikiReader
.
-
-
Method Detail
-
getBaseUrlWiki
public final String getBaseUrlWiki()
Returns the base URL of wiki.- Returns:
- the base URL of wiki
- Since:
- 7434
-
read
public String read(String url) throws IOException
Read the page specified by the url and return the content. If the url is within the baseurl path, parse it as an trac wikipage and replace relative paths etc..- Parameters:
url
- the URL to read- Returns:
- The page as string
- Throws:
IOException
- Throws, if the page could not be loaded.
-
readLang
public String readLang(String text) throws IOException
Reads the localized version of the given wiki page.- Parameters:
text
- The page title, without locale prefix- Returns:
- the localized version of the given wiki page
- Throws:
IOException
- if any I/O error occurs
-
readLang
private String readLang(URL url) throws IOException
- Throws:
IOException
-
readNormal
private static String readNormal(BufferedReader in, boolean html)
-
readFromTrac
protected String readFromTrac(BufferedReader in, URL url) throws IOException
- Throws:
IOException
-
-