4 * License : The MIT License
5 * Copyright(c) 2008 olyutorskii
8 package jp.sourceforge.jindolf.archiver;
10 import java.io.IOException;
11 import java.io.Writer;
12 import java.util.LinkedList;
13 import java.util.List;
14 import jp.sourceforge.jindolf.parser.DecodedContent;
19 public abstract class TopicData{
21 private static final DecodedContent BREAK = new DecodedContent("\n");
23 private final List<DecodedContent> lineList =
24 new LinkedList<DecodedContent>();
29 protected TopicData(){
36 * @param content 行を構成する文字列
38 public void addLine(DecodedContent content){
39 this.lineList.add(content);
46 public void addBreak(){
47 this.lineList.add(BREAK);
55 public int getLineNum(){
56 return this.lineList.size();
63 public DecodedContent get1stLine(){
64 return this.lineList.get(0);
70 * @throws IOException 出力エラー
72 public void dumpLines(Writer writer) throws IOException{
73 DecodedContent lastLine = null;
74 DecodedContent lastContent = null;
76 for(DecodedContent content : this.lineList){
77 lastContent = content;
80 writer.append("</li>\n");
83 writer.append("<li/>\n");
87 writer.append("<li>");
89 XmlUtils.dumpDecodedContent(writer, content);
95 writer.append("</li>\n");
96 }else if(lastContent == BREAK){
97 writer.append("<li/>\n");
106 * @throws IOException 出力エラー
108 public abstract void dumpXml(Writer writer) throws IOException;