mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
64 lines
2.4 KiB
Java
64 lines
2.4 KiB
Java
package io.sentry.util;
|
|
|
|
import com.google.android.exoplayer2.C;
|
|
import io.sentry.ILogger;
|
|
import io.sentry.ISerializer;
|
|
import io.sentry.JsonSerializable;
|
|
import io.sentry.SentryLevel;
|
|
import java.io.BufferedWriter;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.OutputStreamWriter;
|
|
import java.io.Writer;
|
|
import java.nio.charset.Charset;
|
|
import java.util.ArrayList;
|
|
import java.util.Calendar;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.concurrent.atomic.AtomicIntegerArray;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public final class JsonSerializationUtils {
|
|
private static final Charset UTF_8 = Charset.forName(C.UTF8_NAME);
|
|
|
|
public static Map<String, Object> calendarToMap(Calendar calendar) {
|
|
HashMap hashMap = new HashMap();
|
|
hashMap.put("year", Integer.valueOf(calendar.get(1)));
|
|
hashMap.put("month", Integer.valueOf(calendar.get(2)));
|
|
hashMap.put("dayOfMonth", Integer.valueOf(calendar.get(5)));
|
|
hashMap.put("hourOfDay", Integer.valueOf(calendar.get(11)));
|
|
hashMap.put("minute", Integer.valueOf(calendar.get(12)));
|
|
hashMap.put("second", Integer.valueOf(calendar.get(13)));
|
|
return hashMap;
|
|
}
|
|
|
|
public static List<Object> atomicIntegerArrayToList(AtomicIntegerArray atomicIntegerArray) {
|
|
int length = atomicIntegerArray.length();
|
|
ArrayList arrayList = new ArrayList(length);
|
|
for (int i = 0; i < length; i++) {
|
|
arrayList.add(Integer.valueOf(atomicIntegerArray.get(i)));
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public static byte[] bytesFrom(ISerializer iSerializer, ILogger iLogger, JsonSerializable jsonSerializable) {
|
|
try {
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
try {
|
|
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(byteArrayOutputStream, UTF_8));
|
|
try {
|
|
iSerializer.serialize((ISerializer) jsonSerializable, (Writer) bufferedWriter);
|
|
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
|
bufferedWriter.close();
|
|
byteArrayOutputStream.close();
|
|
return byteArray;
|
|
} finally {
|
|
}
|
|
} finally {
|
|
}
|
|
} catch (Throwable th) {
|
|
iLogger.log(SentryLevel.ERROR, "Could not serialize serializable", th);
|
|
return null;
|
|
}
|
|
}
|
|
}
|