mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 16:42:30 -06:00
30 lines
1 KiB
Java
30 lines
1 KiB
Java
package com.alibaba.fastjson.serializer;
|
|
|
|
import com.alibaba.fastjson.parser.DefaultJSONParser;
|
|
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
|
|
import java.io.IOException;
|
|
import java.lang.reflect.Type;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class StringCodec implements ObjectSerializer, ObjectDeserializer {
|
|
public static StringCodec instance = new StringCodec();
|
|
|
|
private StringCodec() {
|
|
}
|
|
|
|
@Override // com.alibaba.fastjson.serializer.ObjectSerializer
|
|
public void write(JSONSerializer jSONSerializer, Object obj, Object obj2, Type type) throws IOException {
|
|
String str = (String) obj;
|
|
SerializeWriter serializeWriter = jSONSerializer.out;
|
|
if (str == null) {
|
|
serializeWriter.writeNull();
|
|
} else {
|
|
serializeWriter.writeString(str);
|
|
}
|
|
}
|
|
|
|
@Override // com.alibaba.fastjson.parser.deserializer.ObjectDeserializer
|
|
public <T> T deserialze(DefaultJSONParser defaultJSONParser, Type type, Object obj) {
|
|
return (T) defaultJSONParser.parseString();
|
|
}
|
|
}
|