/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.io.IOException
 *  java.io.Reader
 *  java.io.StringReader
 *  java.io.StringWriter
 *  java.io.Writer
 *  java.lang.String
 *  java.lang.UnsupportedOperationException
 *  org.xml.sax.InputSource
 */
package org.dom4j.io;

import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import org.dom4j.Document;
import org.dom4j.io.DocumentInputSource$1;
import org.dom4j.io.XMLWriter;
import org.xml.sax.InputSource;

class DocumentInputSource
extends InputSource {
    private Document document;

    public DocumentInputSource() {
    }

    public DocumentInputSource(Document document) {
        this.document = document;
        this.setSystemId(document.getName());
    }

    public Reader getCharacterStream() {
        try {
            StringWriter stringWriter = new StringWriter();
            XMLWriter xMLWriter = new XMLWriter((Writer)stringWriter);
            xMLWriter.write(this.document);
            xMLWriter.flush();
            StringReader stringReader = new StringReader(stringWriter.toString());
            return stringReader;
        }
        catch (IOException var3_4) {
            return new DocumentInputSource$1(this, var3_4);
        }
    }

    public Document getDocument() {
        return this.document;
    }

    public void setCharacterStream(Reader reader) throws UnsupportedOperationException {
        throw new UnsupportedOperationException();
    }

    public void setDocument(Document document) {
        this.document = document;
        this.setSystemId(document.getName());
    }
}

