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 = new LinkedList<>();
28 protected TopicData(){
35 * @param content 行を構成する文字列
37 public void addLine(DecodedContent content){
38 this.lineList.add(content);
45 public void addBreak(){
46 this.lineList.add(BREAK);
54 public int getLineNum(){
55 return this.lineList.size();
62 public DecodedContent get1stLine(){
63 return this.lineList.get(0);
69 * @throws IOException 出力エラー
71 public void dumpLines(Writer writer) throws IOException{
72 DecodedContent lastLine = null;
73 DecodedContent lastContent = null;
75 for(DecodedContent content : this.lineList){
76 lastContent = content;
79 writer.append("</li>\n");
82 writer.append("<li/>\n");
86 writer.append("<li>");
88 XmlUtils.dumpDecodedContent(writer, content);
94 writer.append("</li>\n");
95 }else if(lastContent == BREAK){
96 writer.append("<li/>\n");
105 * @throws IOException 出力エラー
107 public abstract void dumpXml(Writer writer) throws IOException;