1 38 39 40 package org.jvnet.fastinfoset; 41 42 import java.io.InputStream ; 43 import org.xml.sax.InputSource ; 44 import javax.xml.transform.sax.SAXSource ; 45 import com.sun.xml.fastinfoset.sax.SAXDocumentParser; 46 import com.sun.xml.fastinfoset.*; 47 import org.xml.sax.XMLReader ; 48 49 74 public class FastInfosetSource extends SAXSource { 75 76 public FastInfosetSource(InputStream inputStream) { 77 super(new InputSource (inputStream)); 78 } 79 80 public XMLReader getXMLReader() { 81 XMLReader reader = super.getXMLReader(); 82 if (reader == null) { 83 reader = new SAXDocumentParser(); 84 setXMLReader(reader); 85 } 86 ((SAXDocumentParser) reader).setInputStream(getInputStream()); 87 return reader; 88 } 89 90 public InputStream getInputStream() { 91 return getInputSource().getByteStream(); 92 } 93 94 public void setInputStream(InputStream inputStream) { 95 setInputSource(new InputSource (inputStream)); 96 } 97 } 98 | Popular Tags |