Initial commit
This commit is contained in:
374
sources/com/thoughtworks/xstream/io/json/AbstractJsonWriter.java
Normal file
374
sources/com/thoughtworks/xstream/io/json/AbstractJsonWriter.java
Normal file
@@ -0,0 +1,374 @@
|
||||
package com.thoughtworks.xstream.io.json;
|
||||
|
||||
import com.thoughtworks.xstream.core.util.FastStack;
|
||||
import com.thoughtworks.xstream.io.AbstractWriter;
|
||||
import com.thoughtworks.xstream.io.naming.NameCoder;
|
||||
import com.thoughtworks.xstream.io.naming.NoNameCoder;
|
||||
import com.unity3d.ads.metadata.MediationMetaData;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbstractJsonWriter extends AbstractWriter {
|
||||
public static final int DROP_ROOT_MODE = 1;
|
||||
public static final int EXPLICIT_MODE = 4;
|
||||
public static final int IEEE_754_MODE = 8;
|
||||
private static final Set NUMBER_TYPES;
|
||||
private static final int STATE_END_ATTRIBUTES = 32;
|
||||
private static final int STATE_END_ELEMENTS = 256;
|
||||
private static final int STATE_END_OBJECT = 2;
|
||||
private static final int STATE_NEXT_ATTRIBUTE = 16;
|
||||
private static final int STATE_NEXT_ELEMENT = 128;
|
||||
private static final int STATE_ROOT = 1;
|
||||
private static final int STATE_SET_VALUE = 512;
|
||||
private static final int STATE_START_ATTRIBUTES = 8;
|
||||
private static final int STATE_START_ELEMENTS = 64;
|
||||
private static final int STATE_START_OBJECT = 4;
|
||||
public static final int STRICT_MODE = 2;
|
||||
static /* synthetic */ Class class$com$thoughtworks$xstream$mapper$Mapper$Null;
|
||||
static /* synthetic */ Class class$java$io$Externalizable;
|
||||
static /* synthetic */ Class class$java$lang$Boolean;
|
||||
static /* synthetic */ Class class$java$lang$Byte;
|
||||
static /* synthetic */ Class class$java$lang$Character;
|
||||
static /* synthetic */ Class class$java$lang$Double;
|
||||
static /* synthetic */ Class class$java$lang$Float;
|
||||
static /* synthetic */ Class class$java$lang$Integer;
|
||||
static /* synthetic */ Class class$java$lang$Long;
|
||||
static /* synthetic */ Class class$java$lang$Short;
|
||||
static /* synthetic */ Class class$java$math$BigDecimal;
|
||||
static /* synthetic */ Class class$java$math$BigInteger;
|
||||
static /* synthetic */ Class class$java$util$Collection;
|
||||
static /* synthetic */ Class class$java$util$Map;
|
||||
static /* synthetic */ Class class$java$util$Map$Entry;
|
||||
private int expectedStates;
|
||||
private int mode;
|
||||
private FastStack stack;
|
||||
|
||||
private static class IllegalWriterStateException extends IllegalStateException {
|
||||
/* JADX WARN: Illegal instructions before constructor call */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public IllegalWriterStateException(int r3, int r4, java.lang.String r5) {
|
||||
/*
|
||||
r2 = this;
|
||||
java.lang.StringBuffer r0 = new java.lang.StringBuffer
|
||||
r0.<init>()
|
||||
java.lang.String r1 = "Cannot turn from state "
|
||||
r0.append(r1)
|
||||
java.lang.String r3 = getState(r3)
|
||||
r0.append(r3)
|
||||
java.lang.String r3 = " into state "
|
||||
r0.append(r3)
|
||||
java.lang.String r3 = getState(r4)
|
||||
r0.append(r3)
|
||||
if (r5 != 0) goto L22
|
||||
java.lang.String r3 = ""
|
||||
goto L33
|
||||
L22:
|
||||
java.lang.StringBuffer r3 = new java.lang.StringBuffer
|
||||
r3.<init>()
|
||||
java.lang.String r4 = " for property "
|
||||
r3.append(r4)
|
||||
r3.append(r5)
|
||||
java.lang.String r3 = r3.toString()
|
||||
L33:
|
||||
r0.append(r3)
|
||||
java.lang.String r3 = r0.toString()
|
||||
r2.<init>(r3)
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.thoughtworks.xstream.io.json.AbstractJsonWriter.IllegalWriterStateException.<init>(int, int, java.lang.String):void");
|
||||
}
|
||||
|
||||
private static String getState(int i) {
|
||||
if (i == 1) {
|
||||
return "ROOT";
|
||||
}
|
||||
if (i == 2) {
|
||||
return "END_OBJECT";
|
||||
}
|
||||
if (i == 4) {
|
||||
return "START_OBJECT";
|
||||
}
|
||||
if (i == 8) {
|
||||
return "START_ATTRIBUTES";
|
||||
}
|
||||
if (i == 16) {
|
||||
return "NEXT_ATTRIBUTE";
|
||||
}
|
||||
if (i == 32) {
|
||||
return "END_ATTRIBUTES";
|
||||
}
|
||||
if (i == 64) {
|
||||
return "START_ELEMENTS";
|
||||
}
|
||||
if (i == 128) {
|
||||
return "NEXT_ELEMENT";
|
||||
}
|
||||
if (i == 256) {
|
||||
return "END_ELEMENTS";
|
||||
}
|
||||
if (i == 512) {
|
||||
return "SET_VALUE";
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("Unknown state provided: ");
|
||||
stringBuffer.append(i);
|
||||
stringBuffer.append(", cannot create message for IllegalWriterStateException");
|
||||
throw new IllegalArgumentException(stringBuffer.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private static class StackElement {
|
||||
int status;
|
||||
final Class type;
|
||||
|
||||
public StackElement(Class cls, int i) {
|
||||
this.type = cls;
|
||||
this.status = i;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Type {
|
||||
public static Type NULL = new Type();
|
||||
public static Type STRING = new Type();
|
||||
public static Type NUMBER = new Type();
|
||||
public static Type BOOLEAN = new Type();
|
||||
}
|
||||
|
||||
static {
|
||||
Class[] clsArr = new Class[14];
|
||||
clsArr[0] = Byte.TYPE;
|
||||
Class cls = class$java$lang$Byte;
|
||||
if (cls == null) {
|
||||
cls = class$("java.lang.Byte");
|
||||
class$java$lang$Byte = cls;
|
||||
}
|
||||
clsArr[1] = cls;
|
||||
clsArr[2] = Short.TYPE;
|
||||
Class cls2 = class$java$lang$Short;
|
||||
if (cls2 == null) {
|
||||
cls2 = class$("java.lang.Short");
|
||||
class$java$lang$Short = cls2;
|
||||
}
|
||||
clsArr[3] = cls2;
|
||||
clsArr[4] = Integer.TYPE;
|
||||
Class cls3 = class$java$lang$Integer;
|
||||
if (cls3 == null) {
|
||||
cls3 = class$("java.lang.Integer");
|
||||
class$java$lang$Integer = cls3;
|
||||
}
|
||||
clsArr[5] = cls3;
|
||||
clsArr[6] = Long.TYPE;
|
||||
Class cls4 = class$java$lang$Long;
|
||||
if (cls4 == null) {
|
||||
cls4 = class$("java.lang.Long");
|
||||
class$java$lang$Long = cls4;
|
||||
}
|
||||
clsArr[7] = cls4;
|
||||
clsArr[8] = Float.TYPE;
|
||||
Class cls5 = class$java$lang$Float;
|
||||
if (cls5 == null) {
|
||||
cls5 = class$("java.lang.Float");
|
||||
class$java$lang$Float = cls5;
|
||||
}
|
||||
clsArr[9] = cls5;
|
||||
clsArr[10] = Double.TYPE;
|
||||
Class cls6 = class$java$lang$Double;
|
||||
if (cls6 == null) {
|
||||
cls6 = class$("java.lang.Double");
|
||||
class$java$lang$Double = cls6;
|
||||
}
|
||||
clsArr[11] = cls6;
|
||||
Class cls7 = class$java$math$BigInteger;
|
||||
if (cls7 == null) {
|
||||
cls7 = class$("java.math.BigInteger");
|
||||
class$java$math$BigInteger = cls7;
|
||||
}
|
||||
clsArr[12] = cls7;
|
||||
Class cls8 = class$java$math$BigDecimal;
|
||||
if (cls8 == null) {
|
||||
cls8 = class$("java.math.BigDecimal");
|
||||
class$java$math$BigDecimal = cls8;
|
||||
}
|
||||
clsArr[13] = cls8;
|
||||
NUMBER_TYPES = new HashSet(Arrays.asList(clsArr));
|
||||
}
|
||||
|
||||
public AbstractJsonWriter() {
|
||||
this(new NoNameCoder());
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleCheckedStateTransition(int i, String str, String str2) {
|
||||
StackElement stackElement = (StackElement) this.stack.peek();
|
||||
if ((this.expectedStates & i) == 0) {
|
||||
throw new IllegalWriterStateException(stackElement.status, i, str);
|
||||
}
|
||||
stackElement.status = handleStateTransition(stackElement.status, i, str, str2);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:111:0x0167, code lost:
|
||||
|
||||
if (r6 == r0) goto L113;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:177:0x023a, code lost:
|
||||
|
||||
if ((r17.mode & 4) != 0) goto L186;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private int handleStateTransition(int r18, int r19, java.lang.String r20, java.lang.String r21) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 887
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.thoughtworks.xstream.io.json.AbstractJsonWriter.handleStateTransition(int, int, java.lang.String, java.lang.String):int");
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamWriter
|
||||
public void addAttribute(String str, String str2) {
|
||||
handleCheckedStateTransition(16, str, str2);
|
||||
this.expectedStates = 661;
|
||||
}
|
||||
|
||||
protected abstract void addLabel(String str);
|
||||
|
||||
protected abstract void addValue(String str, Type type);
|
||||
|
||||
protected abstract void endArray();
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamWriter
|
||||
public void endNode() {
|
||||
int size = this.stack.size();
|
||||
int i = size > 2 ? 128 : 1;
|
||||
handleCheckedStateTransition(i, null, null);
|
||||
this.stack.pop();
|
||||
((StackElement) this.stack.peek()).status = i;
|
||||
this.expectedStates = 4;
|
||||
if (size > 2) {
|
||||
this.expectedStates |= 129;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void endObject();
|
||||
|
||||
protected Type getType(Class cls) {
|
||||
Class cls2 = class$com$thoughtworks$xstream$mapper$Mapper$Null;
|
||||
if (cls2 == null) {
|
||||
cls2 = class$("com.thoughtworks.xstream.mapper.Mapper$Null");
|
||||
class$com$thoughtworks$xstream$mapper$Mapper$Null = cls2;
|
||||
}
|
||||
if (cls == cls2) {
|
||||
return Type.NULL;
|
||||
}
|
||||
Class cls3 = class$java$lang$Boolean;
|
||||
if (cls3 == null) {
|
||||
cls3 = class$("java.lang.Boolean");
|
||||
class$java$lang$Boolean = cls3;
|
||||
}
|
||||
return (cls == cls3 || cls == Boolean.TYPE) ? Type.BOOLEAN : NUMBER_TYPES.contains(cls) ? Type.NUMBER : Type.STRING;
|
||||
}
|
||||
|
||||
protected boolean isArray(Class cls) {
|
||||
if (cls != null) {
|
||||
if (!cls.isArray()) {
|
||||
Class cls2 = class$java$util$Collection;
|
||||
if (cls2 == null) {
|
||||
cls2 = class$("java.util.Collection");
|
||||
class$java$util$Collection = cls2;
|
||||
}
|
||||
if (!cls2.isAssignableFrom(cls)) {
|
||||
Class cls3 = class$java$io$Externalizable;
|
||||
if (cls3 == null) {
|
||||
cls3 = class$("java.io.Externalizable");
|
||||
class$java$io$Externalizable = cls3;
|
||||
}
|
||||
if (!cls3.isAssignableFrom(cls)) {
|
||||
Class cls4 = class$java$util$Map;
|
||||
if (cls4 == null) {
|
||||
cls4 = class$("java.util.Map");
|
||||
class$java$util$Map = cls4;
|
||||
}
|
||||
if (!cls4.isAssignableFrom(cls)) {
|
||||
Class cls5 = class$java$util$Map$Entry;
|
||||
if (cls5 == null) {
|
||||
cls5 = class$("java.util.Map$Entry");
|
||||
class$java$util$Map$Entry = cls5;
|
||||
}
|
||||
if (cls5.isAssignableFrom(cls)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract void nextElement();
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamWriter
|
||||
public void setValue(String str) {
|
||||
Class cls = ((StackElement) this.stack.peek()).type;
|
||||
Class cls2 = class$java$lang$Character;
|
||||
if (cls2 == null) {
|
||||
cls2 = class$("java.lang.Character");
|
||||
class$java$lang$Character = cls2;
|
||||
}
|
||||
if ((cls == cls2 || cls == Character.TYPE) && "".equals(str)) {
|
||||
str = "\u0000";
|
||||
}
|
||||
handleCheckedStateTransition(512, null, str);
|
||||
this.expectedStates = 129;
|
||||
}
|
||||
|
||||
protected abstract void startArray();
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.AbstractWriter, com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter
|
||||
public void startNode(String str, Class cls) {
|
||||
if (str == null) {
|
||||
throw new NullPointerException(MediationMetaData.KEY_NAME);
|
||||
}
|
||||
FastStack fastStack = this.stack;
|
||||
fastStack.push(new StackElement(cls, ((StackElement) fastStack.peek()).status));
|
||||
handleCheckedStateTransition(4, str, null);
|
||||
this.expectedStates = 661;
|
||||
}
|
||||
|
||||
protected abstract void startObject();
|
||||
|
||||
public AbstractJsonWriter(int i) {
|
||||
this(i, new NoNameCoder());
|
||||
}
|
||||
|
||||
public AbstractJsonWriter(NameCoder nameCoder) {
|
||||
this(0, nameCoder);
|
||||
}
|
||||
|
||||
public AbstractJsonWriter(int i, NameCoder nameCoder) {
|
||||
super(nameCoder);
|
||||
this.stack = new FastStack(16);
|
||||
this.mode = (i & 4) > 0 ? 4 : i;
|
||||
this.stack.push(new StackElement(null, 1));
|
||||
this.expectedStates = 4;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamWriter
|
||||
public void startNode(String str) {
|
||||
startNode(str, null);
|
||||
}
|
||||
}
|
@@ -0,0 +1,154 @@
|
||||
package com.thoughtworks.xstream.io.json;
|
||||
|
||||
import com.thoughtworks.xstream.io.AbstractDriver;
|
||||
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
|
||||
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
||||
import com.thoughtworks.xstream.io.StreamException;
|
||||
import com.thoughtworks.xstream.io.xml.QNameMap;
|
||||
import com.thoughtworks.xstream.io.xml.StaxReader;
|
||||
import com.thoughtworks.xstream.io.xml.StaxWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.net.URL;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import org.codehaus.jettison.mapped.Configuration;
|
||||
import org.codehaus.jettison.mapped.MappedNamespaceConvention;
|
||||
import org.codehaus.jettison.mapped.MappedXMLInputFactory;
|
||||
import org.codehaus.jettison.mapped.MappedXMLOutputFactory;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JettisonMappedXmlDriver extends AbstractDriver {
|
||||
protected final MappedNamespaceConvention convention;
|
||||
protected final MappedXMLInputFactory mif;
|
||||
protected final MappedXMLOutputFactory mof;
|
||||
protected final boolean useSerializeAsArray;
|
||||
|
||||
public JettisonMappedXmlDriver() {
|
||||
this(new Configuration());
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamReader createReader(Reader reader) {
|
||||
try {
|
||||
return new StaxReader(new QNameMap(), this.mif.createXMLStreamReader(reader), getNameCoder());
|
||||
} catch (XMLStreamException e) {
|
||||
throw new StreamException((Throwable) e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamWriter createWriter(Writer writer) {
|
||||
try {
|
||||
return this.useSerializeAsArray ? new JettisonStaxWriter(new QNameMap(), this.mof.createXMLStreamWriter(writer), getNameCoder(), this.convention) : new StaxWriter(new QNameMap(), this.mof.createXMLStreamWriter(writer), getNameCoder());
|
||||
} catch (XMLStreamException e) {
|
||||
throw new StreamException((Throwable) e);
|
||||
}
|
||||
}
|
||||
|
||||
public JettisonMappedXmlDriver(Configuration configuration) {
|
||||
this(configuration, true);
|
||||
}
|
||||
|
||||
public JettisonMappedXmlDriver(Configuration configuration, boolean z) {
|
||||
this.mof = new MappedXMLOutputFactory(configuration);
|
||||
this.mif = new MappedXMLInputFactory(configuration);
|
||||
this.convention = new MappedNamespaceConvention(configuration);
|
||||
this.useSerializeAsArray = z;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamReader createReader(InputStream inputStream) {
|
||||
try {
|
||||
return new StaxReader(new QNameMap(), this.mif.createXMLStreamReader(inputStream), getNameCoder());
|
||||
} catch (XMLStreamException e) {
|
||||
throw new StreamException((Throwable) e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.AbstractDriver, com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamReader createReader(URL url) {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
try {
|
||||
inputStream = url.openStream();
|
||||
StaxReader staxReader = new StaxReader(new QNameMap(), this.mif.createXMLStreamReader(url.toExternalForm(), inputStream), getNameCoder());
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
}
|
||||
return staxReader;
|
||||
} catch (XMLStreamException e) {
|
||||
throw new StreamException((Throwable) e);
|
||||
} catch (IOException e2) {
|
||||
throw new StreamException(e2);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException unused2) {
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamWriter createWriter(OutputStream outputStream) {
|
||||
try {
|
||||
if (this.useSerializeAsArray) {
|
||||
return new JettisonStaxWriter(new QNameMap(), this.mof.createXMLStreamWriter(outputStream), getNameCoder(), this.convention);
|
||||
}
|
||||
return new StaxWriter(new QNameMap(), this.mof.createXMLStreamWriter(outputStream), getNameCoder());
|
||||
} catch (XMLStreamException e) {
|
||||
throw new StreamException((Throwable) e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.AbstractDriver, com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamReader createReader(File file) {
|
||||
FileInputStream fileInputStream;
|
||||
try {
|
||||
try {
|
||||
fileInputStream = new FileInputStream(file);
|
||||
try {
|
||||
StaxReader staxReader = new StaxReader(new QNameMap(), this.mif.createXMLStreamReader(file.toURI().toASCIIString(), fileInputStream), getNameCoder());
|
||||
try {
|
||||
fileInputStream.close();
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
return staxReader;
|
||||
} catch (XMLStreamException e) {
|
||||
e = e;
|
||||
throw new StreamException((Throwable) e);
|
||||
} catch (IOException e2) {
|
||||
e = e2;
|
||||
throw new StreamException(e);
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
if (fileInputStream != null) {
|
||||
try {
|
||||
fileInputStream.close();
|
||||
} catch (IOException unused2) {
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (XMLStreamException e3) {
|
||||
e = e3;
|
||||
} catch (IOException e4) {
|
||||
e = e4;
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
fileInputStream = null;
|
||||
}
|
||||
}
|
||||
}
|
103
sources/com/thoughtworks/xstream/io/json/JettisonStaxWriter.java
Normal file
103
sources/com/thoughtworks/xstream/io/json/JettisonStaxWriter.java
Normal file
@@ -0,0 +1,103 @@
|
||||
package com.thoughtworks.xstream.io.json;
|
||||
|
||||
import com.thoughtworks.xstream.io.naming.NameCoder;
|
||||
import com.thoughtworks.xstream.io.xml.QNameMap;
|
||||
import com.thoughtworks.xstream.io.xml.StaxWriter;
|
||||
import com.thoughtworks.xstream.io.xml.XmlFriendlyReplacer;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamWriter;
|
||||
import org.codehaus.jettison.mapped.MappedNamespaceConvention;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JettisonStaxWriter extends StaxWriter {
|
||||
static /* synthetic */ Class class$java$util$Collection;
|
||||
static /* synthetic */ Class class$java$util$Map;
|
||||
private final MappedNamespaceConvention convention;
|
||||
|
||||
public JettisonStaxWriter(QNameMap qNameMap, XMLStreamWriter xMLStreamWriter, boolean z, boolean z2, NameCoder nameCoder, MappedNamespaceConvention mappedNamespaceConvention) throws XMLStreamException {
|
||||
super(qNameMap, xMLStreamWriter, z, z2, nameCoder);
|
||||
this.convention = mappedNamespaceConvention;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:16:0x0032, code lost:
|
||||
|
||||
if (r6.isArray() == false) goto L21;
|
||||
*/
|
||||
@Override // com.thoughtworks.xstream.io.AbstractWriter, com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public void startNode(java.lang.String r5, java.lang.Class r6) {
|
||||
/*
|
||||
r4 = this;
|
||||
javax.xml.stream.XMLStreamWriter r0 = r4.getXMLStreamWriter()
|
||||
if (r6 == 0) goto L61
|
||||
boolean r1 = r0 instanceof org.codehaus.jettison.AbstractXMLStreamWriter
|
||||
if (r1 == 0) goto L61
|
||||
java.lang.Class r1 = com.thoughtworks.xstream.io.json.JettisonStaxWriter.class$java$util$Collection
|
||||
if (r1 != 0) goto L16
|
||||
java.lang.String r1 = "java.util.Collection"
|
||||
java.lang.Class r1 = class$(r1)
|
||||
com.thoughtworks.xstream.io.json.JettisonStaxWriter.class$java$util$Collection = r1
|
||||
L16:
|
||||
boolean r1 = r1.isAssignableFrom(r6)
|
||||
if (r1 != 0) goto L34
|
||||
java.lang.Class r1 = com.thoughtworks.xstream.io.json.JettisonStaxWriter.class$java$util$Map
|
||||
if (r1 != 0) goto L28
|
||||
java.lang.String r1 = "java.util.Map"
|
||||
java.lang.Class r1 = class$(r1)
|
||||
com.thoughtworks.xstream.io.json.JettisonStaxWriter.class$java$util$Map = r1
|
||||
L28:
|
||||
boolean r1 = r1.isAssignableFrom(r6)
|
||||
if (r1 != 0) goto L34
|
||||
boolean r6 = r6.isArray()
|
||||
if (r6 == 0) goto L61
|
||||
L34:
|
||||
com.thoughtworks.xstream.io.xml.QNameMap r6 = r4.getQNameMap()
|
||||
java.lang.String r1 = r4.encodeNode(r5)
|
||||
javax.xml.namespace.QName r6 = r6.getQName(r1)
|
||||
java.lang.String r1 = r6.getPrefix()
|
||||
java.lang.String r2 = r6.getNamespaceURI()
|
||||
org.codehaus.jettison.mapped.MappedNamespaceConvention r3 = r4.convention
|
||||
java.lang.String r6 = r6.getLocalPart()
|
||||
java.lang.String r6 = r3.createKey(r1, r2, r6)
|
||||
org.codehaus.jettison.AbstractXMLStreamWriter r0 = (org.codehaus.jettison.AbstractXMLStreamWriter) r0
|
||||
java.util.ArrayList r1 = r0.getSerializedAsArrays()
|
||||
boolean r1 = r1.contains(r6)
|
||||
if (r1 != 0) goto L61
|
||||
r0.seriliazeAsArray(r6)
|
||||
L61:
|
||||
r4.startNode(r5)
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.thoughtworks.xstream.io.json.JettisonStaxWriter.startNode(java.lang.String, java.lang.Class):void");
|
||||
}
|
||||
|
||||
public JettisonStaxWriter(QNameMap qNameMap, XMLStreamWriter xMLStreamWriter, boolean z, boolean z2, XmlFriendlyReplacer xmlFriendlyReplacer, MappedNamespaceConvention mappedNamespaceConvention) throws XMLStreamException {
|
||||
this(qNameMap, xMLStreamWriter, z, z2, (NameCoder) xmlFriendlyReplacer, mappedNamespaceConvention);
|
||||
}
|
||||
|
||||
public JettisonStaxWriter(QNameMap qNameMap, XMLStreamWriter xMLStreamWriter, boolean z, boolean z2, MappedNamespaceConvention mappedNamespaceConvention) throws XMLStreamException {
|
||||
super(qNameMap, xMLStreamWriter, z, z2);
|
||||
this.convention = mappedNamespaceConvention;
|
||||
}
|
||||
|
||||
public JettisonStaxWriter(QNameMap qNameMap, XMLStreamWriter xMLStreamWriter, MappedNamespaceConvention mappedNamespaceConvention) throws XMLStreamException {
|
||||
super(qNameMap, xMLStreamWriter);
|
||||
this.convention = mappedNamespaceConvention;
|
||||
}
|
||||
|
||||
public JettisonStaxWriter(QNameMap qNameMap, XMLStreamWriter xMLStreamWriter, NameCoder nameCoder, MappedNamespaceConvention mappedNamespaceConvention) throws XMLStreamException {
|
||||
super(qNameMap, xMLStreamWriter, nameCoder);
|
||||
this.convention = mappedNamespaceConvention;
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
package com.thoughtworks.xstream.io.json;
|
||||
|
||||
import com.thoughtworks.xstream.io.AbstractDriver;
|
||||
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.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.Writer;
|
||||
import java.net.URL;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JsonHierarchicalStreamDriver extends AbstractDriver {
|
||||
public JsonHierarchicalStreamDriver() {
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamReader createReader(Reader reader) {
|
||||
throw new UnsupportedOperationException("The JsonHierarchicalStreamDriver can only write JSON");
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamWriter createWriter(Writer writer) {
|
||||
return new JsonWriter(writer);
|
||||
}
|
||||
|
||||
public JsonHierarchicalStreamDriver(NameCoder nameCoder) {
|
||||
super(nameCoder);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamReader createReader(InputStream inputStream) {
|
||||
throw new UnsupportedOperationException("The JsonHierarchicalStreamDriver can only write JSON");
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamWriter createWriter(OutputStream outputStream) {
|
||||
try {
|
||||
return createWriter(new OutputStreamWriter(outputStream, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new StreamException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.AbstractDriver, com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamReader createReader(URL url) {
|
||||
throw new UnsupportedOperationException("The JsonHierarchicalStreamDriver can only write JSON");
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.AbstractDriver, com.thoughtworks.xstream.io.HierarchicalStreamDriver
|
||||
public HierarchicalStreamReader createReader(File file) {
|
||||
throw new UnsupportedOperationException("The JsonHierarchicalStreamDriver can only write JSON");
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.thoughtworks.xstream.io.json;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JsonHierarchicalStreamWriter extends JsonWriter {
|
||||
public JsonHierarchicalStreamWriter(Writer writer, char[] cArr, String str) {
|
||||
super(writer, cArr, str);
|
||||
}
|
||||
|
||||
public JsonHierarchicalStreamWriter(Writer writer, char[] cArr) {
|
||||
this(writer, cArr, "\n");
|
||||
}
|
||||
|
||||
public JsonHierarchicalStreamWriter(Writer writer, String str, String str2) {
|
||||
this(writer, str.toCharArray(), str2);
|
||||
}
|
||||
|
||||
public JsonHierarchicalStreamWriter(Writer writer, String str) {
|
||||
this(writer, str.toCharArray());
|
||||
}
|
||||
|
||||
public JsonHierarchicalStreamWriter(Writer writer) {
|
||||
this(writer, new char[]{' ', ' '});
|
||||
}
|
||||
}
|
253
sources/com/thoughtworks/xstream/io/json/JsonWriter.java
Normal file
253
sources/com/thoughtworks/xstream/io/json/JsonWriter.java
Normal file
@@ -0,0 +1,253 @@
|
||||
package com.thoughtworks.xstream.io.json;
|
||||
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.thoughtworks.xstream.core.util.QuickWriter;
|
||||
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
||||
import com.thoughtworks.xstream.io.json.AbstractJsonWriter;
|
||||
import com.thoughtworks.xstream.io.naming.NameCoder;
|
||||
import com.thoughtworks.xstream.io.naming.NoNameCoder;
|
||||
import java.io.Writer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JsonWriter extends AbstractJsonWriter {
|
||||
private int depth;
|
||||
protected final Format format;
|
||||
private boolean newLineProposed;
|
||||
protected final QuickWriter writer;
|
||||
|
||||
public static class Format {
|
||||
public static int COMPACT_EMPTY_ELEMENT = 2;
|
||||
public static int SPACE_AFTER_LABEL = 1;
|
||||
private char[] lineIndenter;
|
||||
private final int mode;
|
||||
private final NameCoder nameCoder;
|
||||
private char[] newLine;
|
||||
|
||||
public Format() {
|
||||
this(new char[]{' ', ' '}, new char[]{'\n'}, SPACE_AFTER_LABEL | COMPACT_EMPTY_ELEMENT);
|
||||
}
|
||||
|
||||
public char[] getLineIndenter() {
|
||||
return this.lineIndenter;
|
||||
}
|
||||
|
||||
public NameCoder getNameCoder() {
|
||||
return this.nameCoder;
|
||||
}
|
||||
|
||||
public char[] getNewLine() {
|
||||
return this.newLine;
|
||||
}
|
||||
|
||||
public int mode() {
|
||||
return this.mode;
|
||||
}
|
||||
|
||||
public Format(char[] cArr, char[] cArr2, int i) {
|
||||
this(cArr, cArr2, i, new NoNameCoder());
|
||||
}
|
||||
|
||||
public Format(char[] cArr, char[] cArr2, int i, NameCoder nameCoder) {
|
||||
this.lineIndenter = cArr;
|
||||
this.newLine = cArr2;
|
||||
this.mode = i;
|
||||
this.nameCoder = nameCoder;
|
||||
}
|
||||
}
|
||||
|
||||
public JsonWriter(Writer writer, char[] cArr, String str) {
|
||||
this(writer, 0, new Format(cArr, str.toCharArray(), Format.SPACE_AFTER_LABEL | Format.COMPACT_EMPTY_ELEMENT));
|
||||
}
|
||||
|
||||
private void endNewLine() {
|
||||
int i = this.depth;
|
||||
this.depth = i - 1;
|
||||
if (i > 0) {
|
||||
if ((this.format.mode() & Format.COMPACT_EMPTY_ELEMENT) == 0 || !this.newLineProposed) {
|
||||
writeNewLine();
|
||||
} else {
|
||||
this.newLineProposed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startNewLine() {
|
||||
int i = this.depth + 1;
|
||||
this.depth = i;
|
||||
if (i > 0) {
|
||||
this.newLineProposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void writeNewLine() {
|
||||
int i = this.depth;
|
||||
this.writer.write(this.format.getNewLine());
|
||||
while (true) {
|
||||
int i2 = i - 1;
|
||||
if (i <= 0) {
|
||||
this.newLineProposed = false;
|
||||
return;
|
||||
} else {
|
||||
this.writer.write(this.format.getLineIndenter());
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeText(String str) {
|
||||
int length = str.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
char charAt = str.charAt(i);
|
||||
if (charAt == '\f') {
|
||||
this.writer.write("\\f");
|
||||
} else if (charAt == '\r') {
|
||||
this.writer.write("\\r");
|
||||
} else if (charAt == '\"') {
|
||||
this.writer.write("\\\"");
|
||||
} else if (charAt != '\\') {
|
||||
switch (charAt) {
|
||||
case '\b':
|
||||
this.writer.write("\\b");
|
||||
break;
|
||||
case '\t':
|
||||
this.writer.write("\\t");
|
||||
break;
|
||||
case '\n':
|
||||
this.writer.write("\\n");
|
||||
break;
|
||||
default:
|
||||
if (charAt > 31) {
|
||||
this.writer.write(charAt);
|
||||
break;
|
||||
} else {
|
||||
this.writer.write("\\u");
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("000");
|
||||
stringBuffer.append(Integer.toHexString(charAt));
|
||||
this.writer.write(stringBuffer.toString().substring(r2.length() - 4));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.writer.write("\\\\");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.json.AbstractJsonWriter
|
||||
protected void addLabel(String str) {
|
||||
if (this.newLineProposed) {
|
||||
writeNewLine();
|
||||
}
|
||||
this.writer.write('\"');
|
||||
writeText(str);
|
||||
this.writer.write("\":");
|
||||
if ((this.format.mode() & Format.SPACE_AFTER_LABEL) != 0) {
|
||||
this.writer.write(' ');
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.json.AbstractJsonWriter
|
||||
protected void addValue(String str, AbstractJsonWriter.Type type) {
|
||||
if (this.newLineProposed) {
|
||||
writeNewLine();
|
||||
}
|
||||
if (type == AbstractJsonWriter.Type.STRING) {
|
||||
this.writer.write('\"');
|
||||
}
|
||||
writeText(str);
|
||||
if (type == AbstractJsonWriter.Type.STRING) {
|
||||
this.writer.write('\"');
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamWriter
|
||||
public void close() {
|
||||
this.writer.close();
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.json.AbstractJsonWriter
|
||||
protected void endArray() {
|
||||
endNewLine();
|
||||
this.writer.write("]");
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.json.AbstractJsonWriter
|
||||
protected void endObject() {
|
||||
endNewLine();
|
||||
this.writer.write("}");
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.HierarchicalStreamWriter
|
||||
public void flush() {
|
||||
this.writer.flush();
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.json.AbstractJsonWriter
|
||||
protected void nextElement() {
|
||||
this.writer.write(",");
|
||||
writeNewLine();
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.json.AbstractJsonWriter
|
||||
protected void startArray() {
|
||||
if (this.newLineProposed) {
|
||||
writeNewLine();
|
||||
}
|
||||
this.writer.write("[");
|
||||
startNewLine();
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.json.AbstractJsonWriter
|
||||
protected void startObject() {
|
||||
if (this.newLineProposed) {
|
||||
writeNewLine();
|
||||
}
|
||||
this.writer.write('{');
|
||||
startNewLine();
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.AbstractWriter, com.thoughtworks.xstream.io.HierarchicalStreamWriter
|
||||
public HierarchicalStreamWriter underlyingWriter() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JsonWriter(Writer writer, char[] cArr) {
|
||||
this(writer, 0, new Format(cArr, new char[]{'\n'}, Format.SPACE_AFTER_LABEL | Format.COMPACT_EMPTY_ELEMENT));
|
||||
}
|
||||
|
||||
public JsonWriter(Writer writer, String str, String str2) {
|
||||
this(writer, 0, new Format(str.toCharArray(), str2.toCharArray(), Format.SPACE_AFTER_LABEL | Format.COMPACT_EMPTY_ELEMENT));
|
||||
}
|
||||
|
||||
public JsonWriter(Writer writer, String str) {
|
||||
this(writer, 0, new Format(str.toCharArray(), new char[]{'\n'}, Format.SPACE_AFTER_LABEL | Format.COMPACT_EMPTY_ELEMENT));
|
||||
}
|
||||
|
||||
public JsonWriter(Writer writer) {
|
||||
this(writer, 0, new Format(new char[]{' ', ' '}, new char[]{'\n'}, Format.SPACE_AFTER_LABEL | Format.COMPACT_EMPTY_ELEMENT));
|
||||
}
|
||||
|
||||
public JsonWriter(Writer writer, char[] cArr, String str, int i) {
|
||||
this(writer, i, new Format(cArr, str.toCharArray(), Format.SPACE_AFTER_LABEL | Format.COMPACT_EMPTY_ELEMENT));
|
||||
}
|
||||
|
||||
public JsonWriter(Writer writer, int i) {
|
||||
this(writer, i, new Format());
|
||||
}
|
||||
|
||||
public JsonWriter(Writer writer, Format format) {
|
||||
this(writer, 0, format);
|
||||
}
|
||||
|
||||
public JsonWriter(Writer writer, int i, Format format) {
|
||||
this(writer, i, format, DataDecryptTool.DECRYPT_SP_FILE);
|
||||
}
|
||||
|
||||
public JsonWriter(Writer writer, int i, Format format, int i2) {
|
||||
super(i, format.getNameCoder());
|
||||
this.writer = new QuickWriter(writer, i2);
|
||||
this.format = format;
|
||||
this.depth = (i & 1) == 0 ? -1 : 0;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user