影视仓 v5.0.24版本的 MD5 值为:620341689ccdc375a3b86527e140060e
以下内容为反编译后的 JDomDriver.java 源代码,内容仅作参考
package com.thoughtworks.xstream.io.xml;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.io.StreamException;
import com.thoughtworks.xstream.io.naming.NameCoder;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.net.URL;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
public class JDomDriver extends AbstractXmlDriver {
public JDomDriver() {
super(new XmlFriendlyNameCoder());
}
public SAXBuilder createBuilder() {
SAXBuilder sAXBuilder = new SAXBuilder();
sAXBuilder.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
return sAXBuilder;
}
@Override
public HierarchicalStreamReader createReader(Reader reader) {
try {
return new JDomReader(createBuilder().build(reader), getNameCoder());
} catch (IOException e) {
throw new StreamException(e);
} catch (JDOMException e2) {
throw new StreamException((Throwable) e2);
}
}
@Override
public HierarchicalStreamWriter createWriter(Writer writer) {
return new PrettyPrintWriter(writer, getNameCoder());
}
public JDomDriver(NameCoder nameCoder) {
super(nameCoder);
}
@Override
public HierarchicalStreamWriter createWriter(OutputStream outputStream) {
return new PrettyPrintWriter(new OutputStreamWriter(outputStream));
}
public JDomDriver(XmlFriendlyReplacer xmlFriendlyReplacer) {
this((NameCoder) xmlFriendlyReplacer);
}
@Override
public HierarchicalStreamReader createReader(InputStream inputStream) {
try {
return new JDomReader(createBuilder().build(inputStream), getNameCoder());
} catch (IOException e) {
throw new StreamException(e);
} catch (JDOMException e2) {
throw new StreamException((Throwable) e2);
}
}
@Override
public HierarchicalStreamReader createReader(URL url) {
try {
return new JDomReader(createBuilder().build(url), getNameCoder());
} catch (IOException e) {
throw new StreamException(e);
} catch (JDOMException e2) {
throw new StreamException((Throwable) e2);
}
}
@Override
public HierarchicalStreamReader createReader(File file) {
try {
return new JDomReader(createBuilder().build(file), getNameCoder());
} catch (IOException e) {
throw new StreamException(e);
} catch (JDOMException e2) {
throw new StreamException((Throwable) e2);
}
}
}