public XmlOutput createWriter( Writer w, String encoding ) { // XMLWriter doesn't do buffering, so do it here if it looks like a good idea if(!(w instanceof BufferedWriter)) w = new BufferedWriter(w); assert toBeFlushed==null; toBeFlushed = w; CharacterEscapeHandler ceh = createEscapeHandler(encoding); XMLWriter xw; if(isFormattedOutput()) { DataWriter d = new DataWriter(w,encoding,ceh); d.setIndentStep(indent); xw=d; } else xw = new XMLWriter(w,encoding,ceh); xw.setXmlDecl(!isFragment()); xw.setHeader(header); return new SAXOutput(xw); // TODO: don't we need a better writer? }
public XmlOutput createWriter( OutputStream os, String encoding ) throws JAXBException { // UTF8XmlOutput does buffering on its own, and // otherwise createWriter(Writer) inserts a buffering, // so no point in doing a buffering here. if(encoding.equals("UTF-8")) { Encoded[] table = context.getUTF8NameTable(); final UTF8XmlOutput out; CharacterEscapeHandler ceh = createEscapeHandler(encoding); if(isFormattedOutput()) out = new IndentingUTF8XmlOutput(os, indent, table, ceh); else { if(c14nSupport) out = new C14nXmlOutput(os, table, context.c14nSupport, ceh); else out = new UTF8XmlOutput(os, table, ceh); } if(header!=null) out.setHeader(header); return out; } try { return createWriter( new OutputStreamWriter(os,getJavaEncoding(encoding)), encoding ); } catch( UnsupportedEncodingException e ) { throw new MarshalException( Messages.UNSUPPORTED_ENCODING.format(encoding), e ); } }
public XmlOutput createWriter( Writer w, String encoding ) { // XMLWriter doesn't do buffering, so do it here if it looks like a good idea if(!(w instanceof BufferedWriter)) w = new BufferedWriter(w); assert toBeFlushed==null; toBeFlushed = w; CharacterEscapeHandler ceh = createEscapeHandler(encoding); XMLWriter xw; if(isFormattedOutput()) { DataWriter d = new DataWriter(w,encoding,ceh); d.setIndentStep(indent); xw=d; } else xw = new XMLWriter(w,encoding,ceh); xw.setXmlDecl(!isFragment()); xw.setHeader(header); return new SAXOutput(xw); // TODO: don't we need a better writer? }
public XmlOutput createWriter( OutputStream os, String encoding ) throws JAXBException { // UTF8XmlOutput does buffering on its own, and // otherwise createWriter(Writer) inserts a buffering, // so no point in doing a buffering here. if(encoding.equals("UTF-8")) { Encoded[] table = context.getUTF8NameTable(); final UTF8XmlOutput out; CharacterEscapeHandler ceh = createEscapeHandler(encoding); if(isFormattedOutput()) out = new IndentingUTF8XmlOutput(os, indent, table, ceh); else { if(c14nSupport) out = new C14nXmlOutput(os, table, context.c14nSupport, ceh); else out = new UTF8XmlOutput(os, table, ceh); } if(header!=null) out.setHeader(header); return out; } try { return createWriter( new OutputStreamWriter(os,getJavaEncoding(encoding)), encoding ); } catch( UnsupportedEncodingException e ) { throw new MarshalException( Messages.UNSUPPORTED_ENCODING.format(encoding), e ); } }
public XmlOutput createWriter( Writer w, String encoding ) { // XMLWriter doesn't do buffering, so do it here if it looks like a good idea if(!(w instanceof BufferedWriter)) w = new BufferedWriter(w); assert toBeFlushed==null; toBeFlushed = w; CharacterEscapeHandler ceh = createEscapeHandler(encoding); XMLWriter xw; if(isFormattedOutput()) { DataWriter d = new DataWriter(w,encoding,ceh); d.setIndentStep(indent); xw=d; } else xw = new XMLWriter(w,encoding,ceh); xw.setXmlDecl(!isFragment()); xw.setHeader(header); return new SAXOutput(xw); // TODO: don't we need a better writer? }
public XmlOutput createWriter( Writer w, String encoding ) { // XMLWriter doesn't do buffering, so do it here if it looks like a good idea if(!(w instanceof BufferedWriter)) w = new BufferedWriter(w); assert toBeFlushed==null; toBeFlushed = w; CharacterEscapeHandler ceh = createEscapeHandler(encoding); XMLWriter xw; if(isFormattedOutput()) { DataWriter d = new DataWriter(w,encoding,ceh); d.setIndentStep(indent); xw=d; } else xw = new XMLWriter(w,encoding,ceh); xw.setXmlDecl(!isFragment()); xw.setHeader(header); return new SAXOutput(xw); // TODO: don't we need a better writer? }
public XmlOutput createWriter( OutputStream os, String encoding ) throws JAXBException { // UTF8XmlOutput does buffering on its own, and // otherwise createWriter(Writer) inserts a buffering, // so no point in doing a buffering here. if(encoding.equals("UTF-8")) { Encoded[] table = context.getUTF8NameTable(); final UTF8XmlOutput out; if(isFormattedOutput()) out = new IndentingUTF8XmlOutput(os, indent, table, escapeHandler); else { if(c14nSupport) out = new C14nXmlOutput(os, table, context.c14nSupport, escapeHandler); else out = new UTF8XmlOutput(os, table, escapeHandler); } if(header!=null) out.setHeader(header); return out; } try { return createWriter( new OutputStreamWriter(os,getJavaEncoding(encoding)), encoding ); } catch( UnsupportedEncodingException e ) { throw new MarshalException( Messages.UNSUPPORTED_ENCODING.format(encoding), e ); } }
public XmlOutput createWriter( OutputStream os, String encoding ) throws JAXBException { // UTF8XmlOutput does buffering on its own, and // otherwise createWriter(Writer) inserts a buffering, // so no point in doing a buffering here. if(encoding.equals("UTF-8")) { Encoded[] table = context.getUTF8NameTable(); final UTF8XmlOutput out; CharacterEscapeHandler ceh = createEscapeHandler(encoding); if(isFormattedOutput()) out = new IndentingUTF8XmlOutput(os, indent, table, ceh); else { if(c14nSupport) out = new C14nXmlOutput(os, table, context.c14nSupport, ceh); else out = new UTF8XmlOutput(os, table, ceh); } if(header!=null) out.setHeader(header); return out; } try { return createWriter( new OutputStreamWriter(os,getJavaEncoding(encoding)), encoding ); } catch( UnsupportedEncodingException e ) { throw new MarshalException( Messages.UNSUPPORTED_ENCODING.format(encoding), e ); } }