XMLStreamWriterFactory.java 1002 Bytes
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.internal.xmp.utils;

import com.adobe.internal.xmp.options.SerializeOptions;
import com.adobe.internal.xmp.utils.XMLStreamWriterImpl;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;

public class XMLStreamWriterFactory {
    public static XMLStreamWriterImpl create(Writer writer, SerializeOptions options) {
        return new XMLStreamWriterImpl(writer, options);
    }

    public static XMLStreamWriterImpl create(OutputStream stream, SerializeOptions options) throws IOException {
        try {
            return XMLStreamWriterFactory.create(new BufferedWriter(new OutputStreamWriter(stream, options.getEncoding()), 4096), options);
        }
        catch (UnsupportedEncodingException uee) {
            throw new IOException("Unsupported encoding " + options.getEncoding());
        }
    }
}