日期:2014-05-18 浏览次数:20725 次
public String getArticleContent(String path)
{
File file = new File(path);
String read = "";
StringBuilder sb = new StringBuilder();
InputStreamReader isr = null;
BufferedReader br = null;
try
{
isr = new InputStreamReader(new FileInputStream(file));
br = new BufferedReader(isr);
while ((read = br.readLine()) != null)
{
sb.append(read + "\n");
}
} catch (Exception e)
{
} finally
{
if (br != null)
{
try
{
br.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
if (isr != null)
{
try
{
isr.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
}
return sb.toString();
}
if (res != null)
{
if (res.next())
{
title = res.getString("title");
content = getArticleContent(res
.getString("article_content"));
list.add(new ArticleBean(title, content));
System.out.println("文章路径----->>>"
+ res.getString("article_content"));
System.out.println(content);
} else
{
list.add(new ArticleBean("没有文章", null));
}
}