1 16 package org.apache.cocoon.serialization; 17 18 import java.io.BufferedWriter ; 19 import java.io.OutputStream ; 20 import java.io.OutputStreamWriter ; 21 import java.io.Writer ; 22 23 import org.apache.avalon.framework.CascadingRuntimeException; 24 import org.jfor.jfor.converter.Converter; 25 26 33 34 public class RTFSerializer extends AbstractTextSerializer { 35 36 private Writer rtfWriter; 37 private Converter handler; 38 39 40 45 public void setOutputStream(OutputStream out) { 46 try { 47 rtfWriter = 48 new BufferedWriter (new OutputStreamWriter (out, "ISO-8859-1")); 49 50 handler = new Converter(rtfWriter, 52 Converter.createConverterOption(System.out)); 53 super.setContentHandler(handler); 54 55 } catch (Exception e) { 56 getLogger().error("RTFSerializer.setOutputStream()", e); 57 throw new CascadingRuntimeException("RTFSerializer.setOutputStream()", e); 58 } 59 } 60 61 64 public void recycle() { 65 super.recycle(); 66 this.rtfWriter = null; 67 this.handler = null; 68 } 69 } 70 | Popular Tags |