Package com.envoisolutions.sxc

Source Code of com.envoisolutions.sxc.Writer

package com.envoisolutions.sxc;

import com.envoisolutions.sxc.util.XoXMLStreamWriter;
import com.envoisolutions.sxc.util.XoXMLStreamWriterImpl;

import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import java.io.OutputStream;
import java.util.Map;

public abstract class Writer {
    protected Context context;
    XMLOutputFactory xof = XMLOutputFactory.newInstance();

    public Writer(Context context) {
        this.context = context;
    }

    public void write(OutputStream is, Object o) throws Exception {
        XMLStreamWriter w = xof.createXMLStreamWriter(is);
        write(w, o);
        w.close();
    }
   
    public void write(XMLStreamWriter xsr, Object o) throws Exception {
        write(new XoXMLStreamWriterImpl(xsr), o);
    }
   
    public void write(XMLStreamWriter xsr, Object o,  Map<String, Object> properties) throws Exception {
        write(new XoXMLStreamWriterImpl(xsr), o, properties);
    }   
   
    public void write(XoXMLStreamWriter xw, Object o) throws Exception {
      write(xw, o, null);
    }
   
    public abstract void write(XoXMLStreamWriter xw, Object o, Map<String, Object> properties) throws Exception;
}
TOP

Related Classes of com.envoisolutions.sxc.Writer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.