1 50 51 package com.lowagie.text.rtf.document; 52 53 import java.io.ByteArrayOutputStream ; 54 import java.io.IOException ; 55 import java.io.OutputStream ; 56 import java.util.ArrayList ; 57 58 import com.lowagie.text.rtf.RtfElement; 59 60 61 68 public class RtfInfoGroup extends RtfElement { 69 72 private static final byte[] INFO_GROUP = "\\info".getBytes(); 73 74 77 ArrayList infoElements = null; 78 79 84 public RtfInfoGroup(RtfDocument doc) { 85 super(doc); 86 infoElements = new ArrayList (); 87 } 88 89 94 public void add(RtfInfoElement infoElement) { 95 this.infoElements.add(infoElement); 96 } 97 98 104 public byte[] write() 105 { 106 ByteArrayOutputStream result = new ByteArrayOutputStream (); 107 try { 108 writeContent(result); 109 } catch(IOException e) { 110 e.printStackTrace(); 111 } 112 return result.toByteArray(); 113 } 114 115 118 public void writeContent(final OutputStream result) throws IOException 119 { 120 result.write(OPEN_GROUP); 121 result.write(INFO_GROUP); 122 for(int i = 0; i < infoElements.size(); i++) { 123 RtfInfoElement infoElement = (RtfInfoElement) infoElements.get(i); 124 infoElement.writeContent(result); 126 } 127 result.write(CLOSE_GROUP); 128 result.write((byte) '\n'); 129 } 130 131 } 132 | Popular Tags |