public FastInfosetStreamWriterOutput(StAXDocumentSerializer out, JAXBContextImpl context) { super(out, NoEscapeHandler.theInstance); this.fiout = out; this.localNames = context.getUTF8NameTable(); final VocabularyApplicationData vocabAppData = fiout.getVocabularyApplicationData(); AppData appData = null; if (vocabAppData == null || !(vocabAppData instanceof AppData)) { appData = new AppData(); fiout.setVocabularyApplicationData(appData); } else { appData = (AppData)vocabAppData; } final TablesPerJAXBContext tablesPerContext = appData.contexts.get(context); if (tablesPerContext != null) { tables = tablesPerContext; /** * Obtain the current local name index. Thus will be used to * calculate the maximum index value when serializing for this context */ tables.clearOrResetTables(out.getLocalNameIndex()); } else { tables = new TablesPerJAXBContext(context, out.getLocalNameIndex()); appData.contexts.put(context, tables); } }
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 FastInfosetStreamWriterOutput(StAXDocumentSerializer out, JAXBContextImpl context) { super(out, NoEscapeHandler.theInstance); this.fiout = out; this.localNames = context.getUTF8NameTable(); final VocabularyApplicationData vocabAppData = fiout.getVocabularyApplicationData(); AppData appData = null; if (vocabAppData == null || !(vocabAppData instanceof AppData)) { appData = new AppData(); fiout.setVocabularyApplicationData(appData); } else { appData = (AppData)vocabAppData; } final TablesPerJAXBContext tablesPerContext = appData.contexts.get(context); if (tablesPerContext != null) { tables = tablesPerContext; /** * Obtain the current local name index. Thus will be used to * calculate the maximum index value when serializing for this context */ tables.clearOrResetTables(out.getLocalNameIndex()); } else { tables = new TablesPerJAXBContext(context, out.getLocalNameIndex()); appData.contexts.put(context, tables); } }
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 ); } }
static public void marshalPMML(PMML pmml, OutputStream os) throws JAXBException { JAXBContextImpl context; try { context = (JAXBContextImpl)JAXBUtil.getContext(); } catch(ClassCastException cce){ throw new IllegalStateException("Not a GlassFish Metro runtime", cce); } MarshallerImpl marshaller = context.createMarshaller(); XmlOutput xmlOutput = new PrettyUTF8XmlOutput(os, context.getUTF8NameTable()); marshaller.marshal(pmml, xmlOutput); } }
public FastInfosetStreamWriterOutput(StAXDocumentSerializer out, JAXBContextImpl context) { super(out); this.fiout = out; this.localNames = context.getUTF8NameTable(); final VocabularyApplicationData vocabAppData = fiout.getVocabularyApplicationData(); AppData appData = null; if (vocabAppData == null || !(vocabAppData instanceof AppData)) { appData = new AppData(); fiout.setVocabularyApplicationData(appData); } else { appData = (AppData)vocabAppData; } final TablesPerJAXBContext tablesPerContext = appData.contexts.get(context); if (tablesPerContext != null) { tables = tablesPerContext; /** * Obtain the current local name index. Thus will be used to * calculate the maximum index value when serializing for this context */ tables.clearOrResetTables(out.getLocalNameIndex()); } else { tables = new TablesPerJAXBContext(context, out.getLocalNameIndex()); appData.contexts.put(context, tables); } }
public FastInfosetStreamWriterOutput(StAXDocumentSerializer out, JAXBContextImpl context) { super(out, NoEscapeHandler.theInstance); this.fiout = out; this.localNames = context.getUTF8NameTable(); final VocabularyApplicationData vocabAppData = fiout.getVocabularyApplicationData(); AppData appData = null; if (vocabAppData == null || !(vocabAppData instanceof AppData)) { appData = new AppData(); fiout.setVocabularyApplicationData(appData); } else { appData = (AppData)vocabAppData; } final TablesPerJAXBContext tablesPerContext = appData.contexts.get(context); if (tablesPerContext != null) { tables = tablesPerContext; /** * Obtain the current local name index. Thus will be used to * calculate the maximum index value when serializing for this context */ tables.clearOrResetTables(out.getLocalNameIndex()); } else { tables = new TablesPerJAXBContext(context, out.getLocalNameIndex()); appData.contexts.put(context, tables); } }
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 ); } }