<commit_before>/*
 * Copyright (c) 2016 <NAME>
 */
package org.jpmml.model;

import java.io.OutputStream;

import javax.xml.bind.JAXBException;

import com.sun.xml.bind.v2.runtime.JAXBContextImpl;
import com.sun.xml.bind.v2.runtime.MarshallerImpl;
import com.sun.xml.bind.v2.runtime.output.XmlOutput;
import org.dmg.pmml.PMML;

public class MetroJAXBUtil {

	private MetroJAXBUtil(){
	}

	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);
	}
}<commit_msg>Added utility method MetroJAXBUtil#marshal(PMMLObject, OutputStream)<commit_after>/*
 * Copyright (c) 2016 <NAME>
 */
package org.jpmml.model;

import java.io.OutputStream;

import javax.xml.bind.JAXBException;

import com.sun.xml.bind.v2.runtime.JAXBContextImpl;
import com.sun.xml.bind.v2.runtime.MarshallerImpl;
import com.sun.xml.bind.v2.runtime.output.XmlOutput;
import org.dmg.pmml.PMML;
import org.dmg.pmml.PMMLObject;

public class MetroJAXBUtil {

	private MetroJAXBUtil(){
	}

	static
	public void marshalPMML(PMML pmml, OutputStream os) throws JAXBException {
		marshal(pmml, os);
	}

	static
	public void marshal(PMMLObject object, 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(object, xmlOutput);
	}
}
{'fraction_non_alphanumeric': 0.10853909465020577, 'fraction_numerical': 0.009259259259259259, 'mean_word_length': 5.214057507987221, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1218397', 'n_tokens_mistral': 710, 'n_tokens_neox': 669, 'n_words': 133}