All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.intelie.liverig.witsml.query.AbstractUpdate Maven / Gradle / Ivy

The newest version!
package net.intelie.liverig.witsml.query;

import net.intelie.liverig.util.XMLOutputFactoryFactory;
import net.intelie.liverig.util.XMLStreamWriterAutoCloseable;

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import java.io.StringWriter;

abstract class AbstractUpdate implements Update {
    @Override
    public String xml() {
        StringWriter sw = new StringWriter();
        try (XMLStreamWriterAutoCloseable ac = XMLOutputFactoryFactory.createXMLStreamWriter(sw)) {
            XMLStreamWriter writer = ac.get();
            xml(writer);
            writer.writeEndDocument();
        } catch (XMLStreamException e) {
            throw new RuntimeException(e);
        }
        return sw.toString();
    }

    abstract void xml(XMLStreamWriter writer) throws XMLStreamException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy