Java Code Examples for org.apache.cxf.databinding.DataBinding#createWriter()

The following examples show how to use org.apache.cxf.databinding.DataBinding#createWriter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AttributeTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private String serializeObject(DataBinding dataBinding,
                               AttributeTestBean bean) throws XMLStreamException {
    DataWriter<XMLStreamWriter> writer = dataBinding.createWriter(XMLStreamWriter.class);
    StringWriter stringWriter = new StringWriter();
    XMLStreamWriter xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(stringWriter);
    writer.write(bean, xmlStreamWriter);
    xmlStreamWriter.flush();
    xmlStreamWriter.close();
    return stringWriter.toString();
}
 
Example 2
Source File: SerializationTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private String serializeObject(DataBinding dataBinding, TestBean1 bean) throws XMLStreamException {
    DataWriter<XMLStreamWriter> writer = dataBinding.createWriter(XMLStreamWriter.class);
    StringWriter stringWriter = new StringWriter();
    XMLStreamWriter xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(stringWriter);
    writer.write(bean, xmlStreamWriter);
    xmlStreamWriter.flush();
    xmlStreamWriter.close();
    return stringWriter.toString();
}