/** * Writes a Metatag in the header. * * @param meta the element that has to be written * @throws IOException */ protected void writeHeader(Meta meta) throws IOException { addTabs(2); writeStart(HtmlTags.META); switch(meta.type()) { case Element.HEADER: write(HtmlTags.NAME, ((Header) meta).getName()); break; case Element.SUBJECT: write(HtmlTags.NAME, HtmlTags.SUBJECT); break; case Element.KEYWORDS: write(HtmlTags.NAME, HtmlTags.KEYWORDS); break; case Element.AUTHOR: write(HtmlTags.NAME, HtmlTags.AUTHOR); break; } write(HtmlTags.CONTENT, HtmlEncoder.encode(meta.getContent())); writeEnd(); }
/** * Writes a Metatag in the header. * * @param meta * the element that has to be written * @throws IOException */ protected void writeHeader(Meta meta) throws IOException { addTabs(2); writeStart(HtmlTags.META); switch (meta.type()) { case Element.HEADER: write(HtmlTags.NAME, ((Header) meta).getName()); break; case Element.SUBJECT: write(HtmlTags.NAME, HtmlTags.SUBJECT); break; case Element.KEYWORDS: write(HtmlTags.NAME, HtmlTags.KEYWORDS); break; case Element.AUTHOR: write(HtmlTags.NAME, HtmlTags.AUTHOR); break; } write(HtmlTags.CONTENT, HtmlEncoder.encode(meta.getContent())); writeEnd(); }
/** * Writes the content of one RTF information element. */ public void writeContent(final OutputStream result) throws IOException { result.write(OPEN_GROUP); switch(infoType) { case Meta.AUTHOR: result.write(INFO_AUTHOR); break; case Meta.SUBJECT: result.write(INFO_SUBJECT); break; case Meta.KEYWORDS: result.write(INFO_KEYWORDS); break; case Meta.TITLE: result.write(INFO_TITLE); break; case Meta.PRODUCER: result.write(INFO_PRODUCER); break; case Meta.CREATIONDATE: result.write(INFO_CREATION_DATE); break; default: result.write(INFO_AUTHOR); break; } result.write(DELIMITER); if(infoType == Meta.CREATIONDATE) { result.write(DocWriter.getISOBytes(convertDate(content))); } else { document.filterSpecialChar(result, content, false, false); } result.write(CLOSE_GROUP); }
/** * Constructs a RtfInfoElement based on the given Meta object * * @param doc The RtfDocument this RtfInfoElement belongs to * @param meta The Meta object this RtfInfoElement is based on */ public RtfInfoElement(RtfDocument doc, Meta meta) { super(doc); infoType = meta.type(); content = meta.getContent(); }