影视仓 v5.0.24版本的 MD5 值为:620341689ccdc375a3b86527e140060e
以下内容为反编译后的 TraxSource.java 源代码,内容仅作参考
package com.thoughtworks.xstream.io.xml;
import com.thoughtworks.xstream.XStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.transform.sax.SAXSource;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLFilter;
import org.xml.sax.XMLReader;
public class TraxSource extends SAXSource {
public static final String XSTREAM_FEATURE = "http://com.thoughtworks.xstream/XStreamSource/feature";
private List source;
private XMLReader xmlReader;
private XStream xstream;
public TraxSource() {
super(new InputSource());
this.xmlReader = null;
this.xstream = null;
this.source = null;
}
private void configureXMLReader() {
XMLReader xMLReader = this.xmlReader;
if (xMLReader != null) {
try {
XStream xStream = this.xstream;
if (xStream != null) {
xMLReader.setProperty(SaxWriter.CONFIGURED_XSTREAM_PROPERTY, xStream);
}
List list = this.source;
if (list != null) {
this.xmlReader.setProperty(SaxWriter.SOURCE_OBJECT_LIST_PROPERTY, list);
}
} catch (SAXException e) {
throw new IllegalArgumentException(e.getMessage());
}
}
}
private void createXMLReader(XMLReader xMLReader) {
XMLFilter xMLFilter;
if (xMLReader == null) {
this.xmlReader = new SaxWriter();
} else if (xMLReader instanceof XMLFilter) {
XMLReader xMLReader2 = xMLReader;
while (true) {
xMLFilter = (XMLFilter) xMLReader2;
if (!(xMLFilter.getParent() instanceof XMLFilter)) {
break;
}
xMLReader2 = xMLFilter.getParent();
}
if (!(xMLFilter.getParent() instanceof SaxWriter)) {
xMLFilter.setParent(new SaxWriter());
}
this.xmlReader = xMLReader;
} else {
throw new UnsupportedOperationException();
}
configureXMLReader();
}
@Override
public XMLReader getXMLReader() {
if (this.xmlReader == null) {
createXMLReader(null);
}
return this.xmlReader;
}
@Override
public void setInputSource(InputSource inputSource) {
throw new UnsupportedOperationException();
}
public void setSource(Object obj) {
if (obj != null) {
ArrayList arrayList = new ArrayList(1);
arrayList.add(obj);
setSourceAsList(arrayList);
return;
}
throw new IllegalArgumentException("obj");
}
public void setSourceAsList(List list) {
if (list != null && !list.isEmpty()) {
this.source = list;
configureXMLReader();
return;
}
throw new IllegalArgumentException("list");
}
@Override
public void setXMLReader(XMLReader xMLReader) {
createXMLReader(xMLReader);
}
public void setXStream(XStream xStream) {
if (xStream != null) {
this.xstream = xStream;
configureXMLReader();
return;
}
throw new IllegalArgumentException("xstream");
}
public TraxSource(Object obj) {
super(new InputSource());
this.xmlReader = null;
this.xstream = null;
this.source = null;
setSource(obj);
}
public TraxSource(Object obj, XStream xStream) {
super(new InputSource());
this.xmlReader = null;
this.xstream = null;
this.source = null;
setSource(obj);
setXStream(xStream);
}
public TraxSource(List list) {
super(new InputSource());
this.xmlReader = null;
this.xstream = null;
this.source = null;
setSourceAsList(list);
}
public TraxSource(List list, XStream xStream) {
super(new InputSource());
this.xmlReader = null;
this.xstream = null;
this.source = null;
setSourceAsList(list);
setXStream(xStream);
}
}