Sunbit v2.4.4版本的 MD5 值为:a5021e5e2a58eb1d6741b432fe7533c4

以下内容为反编译后的 a0.java 源代码,内容仅作参考


package d.b.f.u;

import java.beans.XMLDecoder;
import java.beans.XMLEncoder;
import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import k.l3.h0;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
public class a0 {
    public static final String f9667a = "[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]";
    public static final int b = 2;

    public static Document a(InputStream inputStream) throws d.b.f.j.e {
        return b(new InputSource(inputStream));
    }

    public static Document b(File file) {
        d.b.f.n.a.b(file, "Xml file is null !", new Object[0]);
        if (file.exists()) {
            if (file.isFile()) {
                try {
                    file = file.getCanonicalFile();
                } catch (IOException unused) {
                }
                BufferedInputStream bufferedInputStream = null;
                try {
                    bufferedInputStream = d.b.f.m.f.k(file);
                    return a(bufferedInputStream);
                } finally {
                    d.b.f.m.h.a((Closeable) bufferedInputStream);
                }
            }
            throw new d.b.f.j.e("[{}] not a file!", file.getAbsolutePath());
        }
        throw new d.b.f.j.e("File [{}] not a exist!", file.getAbsolutePath());
    }

    public static String c(Document document) {
        return a(document, false);
    }

    public static String d(String str) {
        return a(e(str));
    }

    public static Document e(String str) {
        if (!x.i(str)) {
            return b(new InputSource(x.h(a(str))));
        }
        throw new IllegalArgumentException("XML content string is empty !");
    }

    public static <T> T f(String str) throws IOException {
        return (T) a(new InputSource(x.h(str)));
    }

    public static Document g(String str) {
        if (x.k((CharSequence) str, (char) h0.f19999e)) {
            return e(str);
        }
        return b(d.b.f.m.f.g(str));
    }

    public static Map<String, Object> h(String str) {
        return a(str, (Map<String, Object>) new HashMap());
    }

    public static Document a(Reader reader) throws d.b.f.j.e {
        return b(new InputSource(reader));
    }

    public static Document c() {
        return a().newDocument();
    }

    public static <T> T a(File file) throws IOException {
        return (T) a(new InputSource(d.b.f.m.f.k(file)));
    }

    public static List<Element> c(Element element, String str) {
        return a(element, x.i(str) ? element.getChildNodes() : element.getElementsByTagName(str));
    }

    public static <T> T a(InputSource inputSource) throws IOException {
        AutoCloseable xMLDecoder;
        AutoCloseable autoCloseable = null;
        try {
            xMLDecoder = new XMLDecoder(inputSource);
        } catch (Throwable th) {
            th = th;
        }
        try {
            T t = (T) xMLDecoder.readObject();
            d.b.f.m.h.a(xMLDecoder);
            return t;
        } catch (Throwable th2) {
            th = th2;
            autoCloseable = xMLDecoder;
            d.b.f.m.h.a(autoCloseable);
            throw th;
        }
    }

    public static NodeList c(String str, Object obj) {
        return (NodeList) a(str, obj, XPathConstants.NODESET);
    }

    public static String c(String str) {
        StringBuilder sb = new StringBuilder(str.length());
        int length = str.length();
        for (int i2 = 0; i2 < length; i2++) {
            char charAt = str.charAt(i2);
            if (charAt == '\"') {
                sb.append("&quot;");
            } else if (charAt == '<') {
                sb.append("&lt;");
            } else if (charAt == '>') {
                sb.append("&gt;");
            } else if (charAt == '&') {
                sb.append("&amp;");
            } else if (charAt != '\'') {
                sb.append(charAt);
            } else {
                sb.append("&apos;");
            }
        }
        return sb.toString();
    }

    public static String a(Document document, boolean z) {
        return a(document, "UTF-8", z);
    }

    public static String a(Document document, String str, boolean z) {
        StringWriter b2 = x.b();
        try {
            a(document, b2, str, z ? 2 : 0);
            return b2.toString();
        } catch (Exception e2) {
            throw new d.b.f.j.e(e2, "Trans xml document to string error!", new Object[0]);
        }
    }

    public static Document b(InputSource inputSource) {
        try {
            return a().parse(inputSource);
        } catch (Exception e2) {
            throw new d.b.f.j.e(e2, "Parse XML from stream error!", new Object[0]);
        }
    }

    public static String a(Document document) {
        return a(document, true);
    }

    public static void a(Document document, String str) {
        a(document, str, (String) null);
    }

    public static Document b(String str) {
        Document c = c();
        c.appendChild(c.createElement(str));
        return c;
    }

    public static void a(Document document, String str, String str2) {
        if (x.i(str2)) {
            str2 = document.getXmlEncoding();
        }
        if (x.i(str2)) {
            str2 = "UTF-8";
        }
        BufferedWriter bufferedWriter = null;
        try {
            bufferedWriter = d.b.f.m.f.c(str, str2, false);
            a(document, bufferedWriter, str2, 2);
        } finally {
            d.b.f.m.h.a((Closeable) bufferedWriter);
        }
    }

    public static Element b(Document document) {
        if (document == null) {
            return null;
        }
        return document.getDocumentElement();
    }

    public static Element b(Element element, String str) {
        NodeList elementsByTagName = element.getElementsByTagName(str);
        if (elementsByTagName != null && elementsByTagName.getLength() >= 1) {
            int length = elementsByTagName.getLength();
            for (int i2 = 0; i2 < length; i2++) {
                Element element2 = (Element) elementsByTagName.item(i2);
                if (element2 == null || element2.getParentNode() == element) {
                    return element2;
                }
            }
        }
        return null;
    }

    public static void a(Node node, Writer writer, String str, int i2) {
        a(new DOMSource(node), new StreamResult(writer), str, i2);
    }

    public static void a(Node node, OutputStream outputStream, String str, int i2) {
        a(new DOMSource(node), new StreamResult(outputStream), str, i2);
    }

    public static XPath b() {
        return XPathFactory.newInstance().newXPath();
    }

    public static void a(Source source, Result result, String str, int i2) {
        try {
            Transformer newTransformer = TransformerFactory.newInstance().newTransformer();
            if (i2 > 0) {
                newTransformer.setOutputProperty("indent", "yes");
                newTransformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(i2));
            }
            if (x.n(str)) {
                newTransformer.setOutputProperty("encoding", str);
            }
            newTransformer.transform(source, result);
        } catch (Exception e2) {
            throw new d.b.f.j.e(e2, "Trans xml document to string error!", new Object[0]);
        }
    }

    public static Node b(String str, Object obj) {
        return (Node) a(str, obj, XPathConstants.NODE);
    }

    public static Map<String, Object> b(Node node) {
        return a(node, new HashMap());
    }

    public static String b(Map<?, ?> map, String str) {
        return c(a(map, str));
    }

    public static DocumentBuilder a() {
        DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance();
        a(newInstance);
        try {
            return newInstance.newDocumentBuilder();
        } catch (Exception e2) {
            throw new d.b.f.j.e(e2, "Create xml document error!", new Object[0]);
        }
    }

    public static String a(String str) {
        if (str == null) {
            return null;
        }
        return str.replaceAll(f9667a, "");
    }

    public static String a(Element element, String str) {
        Element b2 = b(element, str);
        if (b2 == null) {
            return null;
        }
        return b2.getTextContent();
    }

    public static String a(Element element, String str, String str2) {
        Element b2 = b(element, str);
        return b2 == null ? str2 : b2.getTextContent();
    }

    public static List<Element> a(NodeList nodeList) {
        return a((Element) null, nodeList);
    }

    public static List<Element> a(Element element, NodeList nodeList) {
        int length = nodeList.getLength();
        ArrayList arrayList = new ArrayList(length);
        for (int i2 = 0; i2 < length; i2++) {
            if (1 == nodeList.item(i2).getNodeType()) {
                Element element2 = (Element) nodeList.item(i2);
                if (element == null || element2.getParentNode() == element) {
                    arrayList.add(element2);
                }
            }
        }
        return arrayList;
    }

    public static void a(File file, Object obj) throws IOException {
        AutoCloseable autoCloseable = null;
        try {
            AutoCloseable xMLEncoder = new XMLEncoder(d.b.f.m.f.m(file));
            try {
                xMLEncoder.writeObject(obj);
                d.b.f.m.h.a(xMLEncoder);
            } catch (Throwable th) {
                th = th;
                autoCloseable = xMLEncoder;
                d.b.f.m.h.a(autoCloseable);
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    public static Element a(String str, Object obj) {
        return (Element) b(str, obj);
    }

    public static Object a(String str, Object obj, QName qName) {
        XPath b2 = b();
        try {
            if (obj instanceof InputSource) {
                return b2.evaluate(str, (InputSource) obj, qName);
            }
            return b2.evaluate(str, obj, qName);
        } catch (XPathExpressionException e2) {
            throw new d.b.f.j.e(e2);
        }
    }

    public static Map<String, Object> a(String str, Map<String, Object> map) {
        Element b2 = b(e(str));
        b2.normalize();
        return a(b2, map);
    }

    public static Map<String, Object> a(Node node, Map<String, Object> map) {
        if (map == null) {
            map = new HashMap<>();
        }
        NodeList childNodes = node.getChildNodes();
        int length = childNodes.getLength();
        for (int i2 = 0; i2 < length; i2++) {
            Node item = childNodes.item(i2);
            if (a(item)) {
                Element element = (Element) item;
                map.put(element.getNodeName(), element.getTextContent());
            }
        }
        return map;
    }

    public static Document a(Map<?, ?> map, String str) {
        Document c = c();
        a(c, a((Node) c, str), map);
        return c;
    }

    public static boolean a(Node node) {
        return node != null && 1 == node.getNodeType();
    }

    public static Element a(Node node, String str) {
        Element createElement = (node instanceof Document ? (Document) node : node.getOwnerDocument()).createElement(str);
        node.appendChild(createElement);
        return createElement;
    }

    private static void a(Document document, Element element, Map<?, ?> map) {
        for (Map.Entry<?, ?> entry : map.entrySet()) {
            Object key = entry.getKey();
            if (key != null) {
                Element createElement = document.createElement(key.toString());
                element.appendChild(createElement);
                Object value = entry.getValue();
                if (value != null) {
                    if (value instanceof Map) {
                        a(document, createElement, (Map) value);
                        element.appendChild(createElement);
                    } else {
                        createElement.appendChild(document.createTextNode(value.toString()));
                    }
                }
            }
        }
    }

    private static DocumentBuilderFactory a(DocumentBuilderFactory documentBuilderFactory) {
        try {
            documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
            documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
            documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
            documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
            documentBuilderFactory.setXIncludeAware(false);
            documentBuilderFactory.setExpandEntityReferences(false);
        } catch (ParserConfigurationException unused) {
        }
        return documentBuilderFactory;
    }
}