/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.io.File
 *  java.io.FileOutputStream
 *  java.io.IOException
 *  java.io.OutputStream
 *  java.io.Writer
 *  java.lang.ClassLoader
 *  java.lang.String
 *  javax.xml.bind.Element
 *  javax.xml.bind.JAXBException
 *  org.xml.sax.SAXException
 */
package org.dom4j.jaxb;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import javax.xml.bind.JAXBException;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.dom4j.jaxb.JAXBSupport;
import org.xml.sax.SAXException;

public class JAXBWriter
extends JAXBSupport {
    private OutputFormat outputFormat;
    private XMLWriter xmlWriter;

    public JAXBWriter(String string2) {
        super(string2);
        this.outputFormat = new OutputFormat();
    }

    public JAXBWriter(String string2, ClassLoader classLoader) {
        super(string2, classLoader);
    }

    public JAXBWriter(String string2, ClassLoader classLoader, OutputFormat outputFormat) {
        super(string2, classLoader);
        this.outputFormat = outputFormat;
    }

    public JAXBWriter(String string2, OutputFormat outputFormat) {
        super(string2);
        this.outputFormat = outputFormat;
    }

    /*
     * Enabled aggressive block sorting
     */
    private XMLWriter getWriter() throws IOException {
        if (this.xmlWriter != null) return this.xmlWriter;
        if (this.outputFormat != null) {
            this.xmlWriter = new XMLWriter(this.outputFormat);
            return this.xmlWriter;
        }
        this.xmlWriter = new XMLWriter();
        return this.xmlWriter;
    }

    public void endDocument() throws IOException, SAXException {
        this.getWriter().endDocument();
    }

    public OutputFormat getOutputFormat() {
        return this.outputFormat;
    }

    public void setOutput(File file) throws IOException {
        super.getWriter().setOutputStream((OutputStream)new FileOutputStream(file));
    }

    public void setOutput(OutputStream outputStream) throws IOException {
        super.getWriter().setOutputStream(outputStream);
    }

    public void setOutput(Writer writer) throws IOException {
        super.getWriter().setWriter(writer);
    }

    public void startDocument() throws IOException, SAXException {
        this.getWriter().startDocument();
    }

    public void write(javax.xml.bind.Element element) throws IOException, JAXBException {
        super.getWriter().write(this.marshal(element));
    }

    public void writeClose(javax.xml.bind.Element element) throws IOException, JAXBException {
        super.getWriter().writeClose(this.marshal(element));
    }

    public void writeCloseElement(Element element) throws IOException {
        super.getWriter().writeClose(element);
    }

    public void writeElement(Element element) throws IOException {
        super.getWriter().write(element);
    }

    public void writeOpen(javax.xml.bind.Element element) throws IOException, JAXBException {
        super.getWriter().writeOpen(this.marshal(element));
    }

    public void writeOpenElement(Element element) throws IOException {
        super.getWriter().writeOpen(element);
    }
}

