1 50 51 package com.lowagie.text.rtf; 52 53 import java.io.IOException ; 54 import java.io.OutputStream ; 55 56 import com.lowagie.text.rtf.document.RtfDocument; 57 58 65 public abstract class RtfElement implements RtfBasicElement { 66 69 protected RtfDocument document = null; 70 73 protected boolean inTable = false; 74 77 protected boolean inHeader = false; 78 79 84 public RtfElement(RtfDocument doc) { 85 super(); 86 this.document = doc; 87 } 88 89 96 public byte[] intToByteArray(int i) 97 { 98 return Integer.toString(i).getBytes(); 99 } 100 101 107 public abstract byte[] write(); 108 109 112 public void writeContent(final OutputStream out) throws IOException 113 { 114 try { 115 byte[] content = write(); 116 out.write(content); 117 } catch(OutOfMemoryError e) { 118 System.out.println(getClass()); 119 throw(e); 120 } catch(RuntimeException e) { 121 System.out.println(getClass()); 122 throw(e); 123 } 124 } 125 126 131 public void setRtfDocument(RtfDocument doc) { 132 this.document = doc; 133 } 134 135 140 public boolean isInTable() { 141 return inTable; 142 } 143 144 149 public void setInTable(boolean inTable) { 150 this.inTable = inTable; 151 } 152 153 158 public void setInHeader(boolean inHeader) { 159 this.inHeader = inHeader; 160 } 161 162 163 } 164 | Popular Tags |