mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 17:42:33 -06:00
133 lines
5.5 KiB
Java
133 lines
5.5 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.collect.Multiset;
|
|
import java.io.IOException;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectOutputStream;
|
|
import java.lang.reflect.Field;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
|
|
@ElementTypesAreNonnullByDefault
|
|
/* loaded from: classes3.dex */
|
|
final class Serialization {
|
|
private Serialization() {
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static int readCount(ObjectInputStream objectInputStream) throws IOException {
|
|
return objectInputStream.readInt();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static <K, V> void writeMap(Map<K, V> map, ObjectOutputStream objectOutputStream) throws IOException {
|
|
objectOutputStream.writeInt(map.size());
|
|
for (Map.Entry<K, V> entry : map.entrySet()) {
|
|
objectOutputStream.writeObject(entry.getKey());
|
|
objectOutputStream.writeObject(entry.getValue());
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static <K, V> void populateMap(Map<K, V> map, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
|
populateMap(map, objectInputStream, objectInputStream.readInt());
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static <K, V> void populateMap(Map<K, V> map, ObjectInputStream objectInputStream, int i) throws IOException, ClassNotFoundException {
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
map.put(objectInputStream.readObject(), objectInputStream.readObject());
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static <E> void writeMultiset(Multiset<E> multiset, ObjectOutputStream objectOutputStream) throws IOException {
|
|
objectOutputStream.writeInt(multiset.entrySet().size());
|
|
for (Multiset.Entry<E> entry : multiset.entrySet()) {
|
|
objectOutputStream.writeObject(entry.getElement());
|
|
objectOutputStream.writeInt(entry.getCount());
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static <E> void populateMultiset(Multiset<E> multiset, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
|
populateMultiset(multiset, objectInputStream, objectInputStream.readInt());
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static <E> void populateMultiset(Multiset<E> multiset, ObjectInputStream objectInputStream, int i) throws IOException, ClassNotFoundException {
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
multiset.add(objectInputStream.readObject(), objectInputStream.readInt());
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static <K, V> void writeMultimap(Multimap<K, V> multimap, ObjectOutputStream objectOutputStream) throws IOException {
|
|
objectOutputStream.writeInt(multimap.asMap().size());
|
|
for (Map.Entry<K, Collection<V>> entry : multimap.asMap().entrySet()) {
|
|
objectOutputStream.writeObject(entry.getKey());
|
|
objectOutputStream.writeInt(entry.getValue().size());
|
|
Iterator<V> it = entry.getValue().iterator();
|
|
while (it.hasNext()) {
|
|
objectOutputStream.writeObject(it.next());
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static <K, V> void populateMultimap(Multimap<K, V> multimap, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
|
populateMultimap(multimap, objectInputStream, objectInputStream.readInt());
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static <K, V> void populateMultimap(Multimap<K, V> multimap, ObjectInputStream objectInputStream, int i) throws IOException, ClassNotFoundException {
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
Collection collection = multimap.get(objectInputStream.readObject());
|
|
int readInt = objectInputStream.readInt();
|
|
for (int i3 = 0; i3 < readInt; i3++) {
|
|
collection.add(objectInputStream.readObject());
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static <T> FieldSetter<T> getFieldSetter(Class<T> cls, String str) {
|
|
try {
|
|
return new FieldSetter<>(cls.getDeclaredField(str));
|
|
} catch (NoSuchFieldException e) {
|
|
throw new AssertionError(e);
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes3.dex */
|
|
static final class FieldSetter<T> {
|
|
private final Field field;
|
|
|
|
private FieldSetter(Field field) {
|
|
this.field = field;
|
|
field.setAccessible(true);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public void set(T t, Object obj) {
|
|
try {
|
|
this.field.set(t, obj);
|
|
} catch (IllegalAccessException e) {
|
|
throw new AssertionError(e);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public void set(T t, int i) {
|
|
try {
|
|
this.field.set(t, Integer.valueOf(i));
|
|
} catch (IllegalAccessException e) {
|
|
throw new AssertionError(e);
|
|
}
|
|
}
|
|
}
|
|
}
|