1
我正在使用read line從維基百科獲取一些文本。但讀線只返回列表,而不是我想要的文本。有沒有辦法使用替代方案或解決我的問題?.readLine()/ readLine的替代方法僅返回列表
public class mediawiki {
public static void main(String[] args) throws Exception {
URL yahoo = new URL(
"http://en.wikipedia.org/w/index.php?title=Jesus&action=raw"
);
BufferedReader in = new BufferedReader(
new InputStreamReader(yahoo.openStream())
);
String inputLine;
//http://en.wikipedia.org/w/index.php?title=Space&action=raw
while ((inputLine = in.readLine()) != null) {
String TEST = in.readLine();
//while ((inputLine = in.readLine()) != null)
//System.out.println(inputLine);
//This basicly reads each line, using
//the read line command to progress
WikiModel wikiModel = new WikiModel(
"http://www.mywiki.com/wiki/${image}",
"http://www.mywiki.com/wiki/${title}"
);
String plainStr = wikiModel.render(
new PlainTextConverter(),
TEST
);
System.out.print(plainStr);
}
}
}
你是什麼意思'readline只返回列表'?閱讀行會爲讀者遇到的每一行返回一個字符串。 – Joseph 2011-06-02 20:10:51
你的'PlainTextConverter'和你的'WikiModel'是什麼?這些不是標準平臺的一部分。 – 2011-06-02 20:58:29