1 16 package org.apache.cocoon.reading; 17 18 import org.apache.avalon.excalibur.pool.Recyclable; 19 import org.apache.avalon.framework.logger.AbstractLogEnabled; 20 import org.apache.avalon.framework.parameters.Parameters; 21 import org.apache.cocoon.ProcessingException; 22 import org.apache.cocoon.environment.SourceResolver; 23 import org.xml.sax.SAXException ; 24 25 import java.io.BufferedOutputStream ; 26 import java.io.IOException ; 27 import java.io.OutputStream ; 28 import java.util.Map ; 29 30 37 public abstract class AbstractReader 38 extends AbstractLogEnabled 39 implements Reader, Recyclable { 40 41 42 protected SourceResolver resolver; 43 44 protected Map objectModel; 45 46 protected Parameters parameters; 47 48 protected String source; 49 50 protected OutputStream out; 51 52 56 public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) 57 throws ProcessingException, SAXException , IOException { 58 this.resolver=resolver; 59 this.objectModel=objectModel; 60 this.source=src; 61 this.parameters=par; 62 } 63 64 67 public void setOutputStream(OutputStream out) { 68 if ( out instanceof BufferedOutputStream 69 || out instanceof org.apache.cocoon.util.BufferedOutputStream ) { 70 this.out = out; 71 } else { 72 this.out = new BufferedOutputStream (out, 1536); 73 } 74 } 75 76 81 public String getMimeType() { 82 return null; 83 } 84 85 89 public long getLastModified() { 90 return 0; 91 } 92 93 96 public void recycle() { 97 this.out = null; 98 this.resolver = null; 99 this.source = null; 100 this.parameters = null; 101 this.objectModel = null; 102 } 103 104 107 public boolean shouldSetContentLength() { 108 return false; 109 } 110 111 } 112 | Popular Tags |